Sample Header Ad - 728x90

Root couldn't write to file with rw permissions for all users and owned by other user

5 votes
1 answer
651 views
I have script that can be runned from different users on the same machine. This script should write logs to the same file on every run. Minimal version of script: #!/usr/bin/env bash # 2 touch /var/tmp/lll.log # 3 chmod 666 /var/tmp/lll.log # 4 (You can comment this line, but this will change nothing) echo ghghhghg >> /var/tmp/lll.log # 5 There is no problem when it started from root and then from other user, but error thrown when order is opposite. ./savetmp.sh: line 5: /var/tmp/lll.log: Permission denied Output of ls -ld /var/tmp /var/tmp/lll.log: .rw------- 9 armoken 1 May 10:52 /var/tmp/lll.log drwxrwxrwt - root 1 May 10:52 /var/tmp cat /proc/sys/fs/protected_regular: 1 How to fix that?
Asked by armoken (53 rep)
May 1, 2024, 08:03 AM
Last activity: May 1, 2024, 12:58 PM