I have a limited user and access to root. How can I give that user the possibility to remove files owned by root?
I have the following line added in /etc/sudoers.d/john : john ALL=(ALL) NOPASSWD:/var/opt/OV/tmp/*yet I'm unable to perform touch or rm commands under /var/opt/OV/tmp. What do I need extra?
I don't know the syntax or how it should exactly be set, so the user john can execute only rm or touch under /var/opt/OV/tmp/. I'm thinking somewhere allong the lines
Cmnd_Alias REMOVE=/bin/rm
Cmnd_Alias CREATE=/bin/touch
john ALL = (ALL) NOPASSWD: REMOVE, CREATE, /var/opt/OV/tmp. Let me know if this might work or if I need something added/removed. No, the chmod&chown commands will not help since the files under /var/opt/OV/tmp are owned by root.
rm /var/log/*usingsudowould, in my humble opinion, be a really bad idea. It would be better to allow them to run a script (with no arguments) that deleted pre-selected files (or rotated them, even better).john ALL = (ALL) NOPASSWD: /var/log/* rm rfenough ?sudomatches wildcards (across word boundaries) -man sudoerseven warns against this specificallyjohn ALL = (ALL) NOPASSWD: /bin/rm -rf /var/log/*? This totally wrecks the security of the server. John would be able tosudo rm -rf /var/log/../../etcand trash the server.