I need to bypass sudo for a group of commands for a certain user so the command is just executed without using the sudo


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?

| improve this answer | |

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 sudo.


sudo su

paul@test-machine:~$ sudo su
[sudo] password for paul: 
root@test-machine:/home/paul# exit

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:

su root

If the correct password is provided, ownership of the session is changed to root.

| improve this answer | |
  • this will enable the user to do any thing he needs , i just want to do this for a group of commands – Fat Mind May 1 '14 at 13:08
  • Can you explain your use in a little more detail. – Paul K May 1 '14 at 13:34
  • i need to enable the reboot command for a user so he writes reboot without sudo – Fat Mind May 1 '14 at 14:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.