regarding sudoers permission
Dear Experts ,
I have a normal user 'bob' in linux . I try to execute below command : chmod o+r file1 using bob . but It denied . Now I want to add bob user in sudoers file so that bob can permit only execute this command . And make sure that Bob should not execute other privileged command . I need your help ... |
Isn't it easier to make file1 owned by a group bob is member of?
|
what did you try?
I used to suggest to implement the required functionality in a shell script (which can only do what you need) and you can add sudo right to bob to execute this script. https://unix.stackexchange.com/quest...assword-prompt |
Actually I use chmod command into one of my script and mention below line on sudoers file :
## Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL %bob ALL=(ALL) NOPASSWD: ALL But so far i know , 'ALL' can execute all privileged command but I just need chmod command only . |
Check out this link might help: https://kifarunix.com/run-only-speci...sudo-in-linux/
From link above: Quote:
|
But if Bob had the sudo ability to chmod any file then he would have the ability to make any file writable and so alter any file, wouldn't he?
|
Quote:
For example take one filename argument, but works only in a specified directory. Anyway a setgid dir probably better... |
Thanks all.. I got my solution ..
|
Quote:
Don't hit and run. Others will benefit. |
cat /etc/sudiers :
myusername ALL = (root) NOPASSWD: /path/to/my/program here my user name is 'backup' "backupe ALL = (root) NOPASSWD: /sbin/gzip chmod " Later on I add below lines onto the script : cd /u01/backup sudo gzip OBUDB_before.$Date.dmp cd /u01/backup sudo /bin/chmod o+r * |
All times are GMT -5. The time now is 03:12 PM. |