This Blog is to share our knowledge and expertise on Linux System Administration and VMware Administration

Friday, January 12, 2018

Which command is used to run sudo commands without password

Command used to run sudo commands without password

     sudo - execute a command as another user

sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.

But here option s is used to run the privileged commands without password.

[nsk@testserver ~]$ sudo -s /etc/init.d/nslcd restart
Stopping nslcd:                                            [  OK  ]
Starting nslcd:                                              [  OK  ]
[nsk@testserver ~]$

-s [command] The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in the password database.  If a command is specified, it is passed to the shell for execution via the shell’s -c option.  If no command is specified, an interactive shell is executed.

No comments:

Post a Comment