I need to bypass
sudo for a group of commands for a certain user so the command is just executed without using the
You want to allow a user to reboot without using the sudo cammand, add the command to
/etc/sudoers file : add this line to the file :
your-username ALL=NOPASSWD: reboot
A more detailed description can be found here: How do I run specific sudo commands without a password?
Since you want to bypass sudo, I assume you do not want to type sudo each time you execute certain commands.
su will change the user session to root, making all further commands executed as root, hence no need for
paul@test-machine:~$ sudo su [sudo] password for paul: root@test-machine:/home/paul# root@test-machine:/home/paul# exit exit paul@test-machine:~$
This command executes the change of session as root (
sudo), to the root user (
su root). su assumes you want to be root, so you don't need to tell it the user.
Information found here: http://www.linfo.org/su.html
su is usually the simplest and most convenient way to change the ownership of a login session to root or to any other user.
A simplified expression of the syntax of the su command is:
su [options] [commands] [-] [username]
The square brackets indicate that the enclosed item is optional. Thus, the simplest way to use the su command is to just type:
The operating system assumes that, in the absence of a username, the user wants to change to a root session, and thus the user is prompted for the root password as soon as the ENTER key is pressed. This produces the same result as typing:
If the correct password is provided, ownership of the session is changed to root.