# Undocumented shell command in image builder docs

**URL:** <https://forum.openwrt.org/t/undocumented-shell-command-in-image-builder-docs/121783>\
**Category:** Talk about Documentation\
**Created:** [March 3, 2022, 6:38pm UTC](https://forum.openwrt.org/t/undocumented-shell-command-in-image-builder-docs/121783 "2022-03-03T18:38:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![harpia](https://forum.openwrt.org/user_avatar/forum.openwrt.org/harpia/32/134738_2.png) [@harpia](https://forum.openwrt.org/u/harpia)\
**Post date:** [March 3, 2022, 6:38pm UTC](https://forum.openwrt.org/t/undocumented-shell-command-in-image-builder-docs/121783/1 "2022-03-03T18:38:43Z")

</div>

The shell command below is at [https://openwrt.org/docs/guide-user/additional-software/imagebuilder?rev=1639962402#restricting\_root\_access](https://openwrt.org/docs/guide-user/additional-software/imagebuilder?rev=1639962402#restricting_root_access) (currently with revision 1639962402)

`touch /etc/environment`

I have no idea why this is needed. I went through all those commands but skipped this one. Everything still worked as expected. Can anyone explain it? It might be a good idea to add a comment there.

---

<div class="post-metadata">

**Author:** ![hnyman](https://forum.openwrt.org/user_avatar/forum.openwrt.org/hnyman/32/19_2.png) [@hnyman](https://forum.openwrt.org/u/hnyman)\
**Post date:** [March 3, 2022, 7:02pm UTC](https://forum.openwrt.org/t/undocumented-shell-command-in-image-builder-docs/121783/2 "2022-03-03T19:02:00Z")

</div>

> [@harpia](#):
>
> touch /etc/environment

> [@harpia](#):
>
> Can anyone explain it?

Possibly @vgaetera can explain the purpose, as he added that segment in September 2021.

Edit: Googling for that file shows info that it is usually systemwide environment variables, but I have no clear idea why touching it (creating an empty file) helps in restricting non-root access. Preventing non-root users from creating it later?

---

<div class="post-metadata">

**Author:** ![RuralRoots](https://forum.openwrt.org/letter_avatar/ruralroots/32/5_5575768a8748004e209b776fc1b2916d.png) [@RuralRoots](https://forum.openwrt.org/u/RuralRoots)\
**Post date:** [March 3, 2022, 7:04pm UTC](https://forum.openwrt.org/t/undocumented-shell-command-in-image-builder-docs/121783/3 "2022-03-03T19:04:04Z")

</div>

> [@harpia](#):
>
> touch /etc/environment

Sets or creates the current time/date of the file `/etc/environment`  
FWIW, not existing here. But that's what it does.

---

<div class="post-metadata">

**Author:** ![anomeome](https://forum.openwrt.org/user_avatar/forum.openwrt.org/anomeome/32/15002_2.png) [@anomeome](https://forum.openwrt.org/u/anomeome)\
**Post date:** [March 3, 2022, 7:26pm UTC](https://forum.openwrt.org/t/undocumented-shell-command-in-image-builder-docs/121783/4 "2022-03-03T19:26:49Z")

</div>

Presumably _sudo_ is checking / wants file extent.

---

<div class="post-metadata">

**Author:** ![vgaetera](https://forum.openwrt.org/user_avatar/forum.openwrt.org/vgaetera/32/113586_2.png) [@vgaetera](https://forum.openwrt.org/u/vgaetera)\
**Post date:** [April 23, 2023, 5:16pm UTC](https://forum.openwrt.org/t/undocumented-shell-command-in-image-builder-docs/121783/5 "2023-04-23T17:16:49Z")

</div>

There was a [persistent error](https://www.linuxquestions.org/questions/slackware-14/sudo-started-complaining-about-missing-etc-environment-4175662768/#post6048177):

> [@](#):
>
> ```bash
> > sudo -i
> sudo: /etc/environment: No such file or directory
> 
> ```

But I can no longer reproduce it on the current stable OpenWrt release, so removed the line.

---

<div class="post-metadata">

**Author:** ![system](https://forum.openwrt.org/uploads/default/original/3X/7/4/740520c71f00039bbf001045c682f0ecb25e905a.png) [@system](https://forum.openwrt.org/u/system)\
**Post date:** [May 3, 2023, 5:17pm UTC](https://forum.openwrt.org/t/undocumented-shell-command-in-image-builder-docs/121783/6 "2023-05-03T17:17:01Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
