how to give sudo previlage user to access particular commands only execcuted
i am try this one but its not working
$ sudo vi /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Host alias specification
User alias specification
Cmnd alias specification
User privilege specification
root ALL=(ALL:ALL) ALL
pradeep ALL=(ALL:ALL) /bin/cp
Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
See sudoers(5) for more information on “#include” directives:
#includedir /etc/sudoers.d
~
“/etc/sudoers” [readonly] 31L, 798C 1,1 All
Always use visudo editing the file /etc/sudoers is not recommended, because the main advantage of visudo is it will prompt you an warning message if you did any syntax error with in the file.
i want to give the particular user to gain acess for the root privilages but only for certain commands like copying,removing,installing, shutdown. reboot like that,
if i give the line like
"usera ALL=(ALL) /bin/cp /sbin/shutdown /bin/chmod /bin/chown " only the first command /bin/cp is working rest of them are not working, can u tell whats the mistake i m doing, thanks in advance
Thanks raghu, i ll try this and one more doubt is that , how can i come to know for a particular command i should give /sbin/shutdown for shutdown, /bin/chmod for changemod like that, because there are many commands available in many directory example,
in /sbin many commands are there, /bin many commands are there and in /usr/bin /usr/bin many commands are there, how can i go and take the exact path for the command to execute, can u explain it???
for example, for reboot im finding two command path ,
and the next thing is /sbin contains commands for the superuser
/bin comtains commands for the user
then what does /usr/bin or /usr/sbin contains???