Undocumented shell command in image builder docs

The shell command below is at 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.

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?

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

Presumably sudo is checking / wants file extent.

2 Likes