-
I've noticed that a sudo user I have on my Fritzbox isn't able to write to /var/tmp Because of this the function In the previous boxes the /var/tmp folder has a sticky bit set As I said, I already have several workarounds, but how unsafe is the old permission of /tmp with a sticky bit?? |
Beta Was this translation helpful? Give feedback.
Replies: 15 comments 7 replies
-
As a workaround to writing to /tmp I chose this approach.
Maybe I'm overthinking it too much as this is giving me a working solution for this script. |
Beta Was this translation helpful? Give feedback.
-
AVM changes the /tmp behaviour many times, eg set to 700 some FOS versions ago. If i remember correctly, ctlmgr unpacks /var.tar to /var/tmp (/tmp links to it). ctlmgr is a closed source blob and you never know what it really does |
Beta Was this translation helpful? Give feedback.
-
I decided to be more careful when writing scripts for non-priviliged users. It may break things I don't know about and it's not worth that. I'm sure however about the Freetz /tmp permission on boxes running 7.12 / 7.13 and older. Thanks for your input |
Beta Was this translation helpful? Give feedback.
-
Yes, the /tmp folder is now working for non-privileged users. |
Beta Was this translation helpful? Give feedback.
-
I already noticed on a box that permissions reverted or were not set: stat /var/tmp reboot stat /var/tmp It was the first boot after flashing it. It may well be the reason why the /var/tmp was not set or reverted the setting. I'm now monitoring the permission of /var/tmp and I will also be notified of a change in the permission. I have some 15 boxes that do not have 1777 applied (anymore?) other box with problem: root@# stat -c '%a' /var/tmp |
Beta Was this translation helpful? Give feedback.
-
Either the permissions are never set sometimes or they are reverted soon after. # uptime |
Beta Was this translation helpful? Give feedback.
-
In the startup script of the daemon that's running as a non-privileged user I have inserted the line chmod 1777 /var/tmp In the meantime I've already applied a chmod 1777 /var/tmp manually on the boxes that are now on 0755 |
Beta Was this translation helpful? Give feedback.
-
I think it's a timing issue. You could replace "chmod 1777 /var/tmp/" in /etc/init.d/rc.mod with this:
It will create a mini-script which sets the permissions, waits a minute and sets it again and removes itself. (this message will self-destruct....) It then calls the script deamonised, so it doesn't halt the process in /etc/init.d.rc.mod. In the meantime I will keep all my boxes monitored and will let you know if one of these boxes reverts to 0755 without having restarted. |
Beta Was this translation helpful? Give feedback.
-
https://freetz-ng.github.io/freetz-ng/NEWS.html#2020-11-18 The "sleep 60" may work for you, but other devices could take longer, eg a common crapp telekom connection needs 170seconds to synchronize |
Beta Was this translation helpful? Give feedback.
-
Well, it does the chmod immediately and then repeats it after a minute. As I wrote. I have it monitored on 60+ boxes. For now, my guess is that it just goes wrong on startup, but not always. It could be it's doing it too early sometimes. |
Beta Was this translation helpful? Give feedback.
-
I just have my first box that reverted to '755' |
Beta Was this translation helpful? Give feedback.
-
I have my first box with an uptime of more than a day which had its permissions changed after a day (?).
This confirms that there's a need to keep it at 1777 BTW I still do not know if you assumed it could be changed during runtime by AVM or that you knew it gets changed. EDIT |
Beta Was this translation helpful? Give feedback.
-
I have modified the script that's run with "sudo" and added this line:
This script is invoked each 10 minutes and is also the script which needed permission to write on /var/tmp The chmod is only run when it's not 1777 and it will get logged (in /var/tmp however) It's not a generic solution, but one for my specific use-case |
Beta Was this translation helpful? Give feedback.
-
The best solution is to prevent the ctlmgr to prevent to execute "chmod". When libctlmgr works with supervisor (fos 7.2+) again this should be fixed. As this need much time to test i've not planned to do it this year |
Beta Was this translation helpful? Give feedback.
-
It seems the permission setting of /var/tmp in /etc/init.d/rc.mod is too early.
I know this doesn't fix the changing of permissions by ctlmgr somewhere later on.
Other box
The first digit shows at which try it needs to set the permissions again. I know I need to fix this a proper way, but I also need a fix now for all the production boxes I have... The script /sbin/wifion is run every 10 minutes and it is also the script which runs with sudo and needs to write to /tmp I didn't think of it when I wrote the script, but the non-privileged sudo user shouldn't be able to write to /var/tmp/perm-tmp as it already exists, was created by root and only has write privs for the root user. I assumed the sticky bit would prevent it writing to it as a non-privileged user. I did a test on a mature linux machine and I was unable to write to a file created by root in /tmp head /sbin/wifion
|
Beta Was this translation helpful? Give feedback.
Old FOS without systemd-alike unpacked var in
./etc/init.d/rc.S
, newer inbuild/original/filesystem/etc/boot.d/core/head
.But there is no sticky in
build/*/filesystem/var.tar
so it could no be unpacked... You could try to extend 68eaf28sure? You have to find what changed...