You are not logged in.
Hello! I noticed that if you:
# As normal user
1. cd /tmp
2. touch file
# As root / any other user (let's consider root here)
3. su root
4. nano file
You get write error. So you might change the permissions to 666. That doesn't work either. No luck with omnipotent 777.
I tried mounting a mere 4 MiB partition as type tmpfs. And I saw the same behaviour too!
Yes, you can `sudo echo something > file` but then you can't edit it as the original owner.
Actually I got the problem on Arch Linux x86_64 and Arch Linux ARM while trying to write a ruby script to manage the system memory (not using low level stuff BTW!)
If you are interested, below is the that I posted first (wrongly on stackoverflow).
https://stackoverflow.com/questions/570 … 5_57023455
Here are 2 links to the screenshots:
https://imgur.com/tB4T5Jl
https://imgur.com/hzc5s27
But as the problem applicable only for Arch Linux (and not Ubuntu or Linux Mint as tested) I hope to see some interesting answers!
Last edited by Sourav (2019-07-14 19:24:27)
Offline
Offline
Thank you very much! Problem solved in one line
Offline
answer here
https://git.kernel.org/pub/scm/linux/ke … s.txt#n233
and in this file
/usr/lib/sysctl.d/50-default.conf
Offline
You did solve it by creating the file as root (if you could not run the process as none root)(preferably with a unique path / name) rather than disabling the sysctl?
Offline
Yes I just disabled it with
```
sysctl fs.protected_regular=0
sysctl fs.protected_fifos=0
```
In my Ruby program the problem get worse if the log file is created after running it as normal user and then root user re-runs the program!
Let me add `begin <...> rescue Errno::EACCES` block in my program!
You did solve it by creating the file as root (if you could not run the process as none root)(preferably with a unique path / name) rather than disabling the sysctl?
Last edited by Sourav (2019-07-14 20:16:10)
Offline
Yes I just disabled it with
```
sysctl fs.protected_regular=0
sysctl fs.protected_fifos=0
``
Undermining the default security of the system in its own fashion is not the best idea.
Look for a more reasonable solution. Consider another folder.
/var/tmp
Offline