Fedora: how to add a sudo user (and avoid password)

How to add a user in the sudo list

If you need to type commands using sudo, you will soon be tired to enter the sudo password again and again. Here are the steps to add a user in the sudo user list and to avoid typing the password. note that those commands need to be run with sudo.

First, edit the file /etc/sudoers, and add the following line somewhere:


%users ALL=(ALL) ALL

Save and exit. Then, you need to add your name to the user group. Type the following command in a shell:

usermod -a -G users <your username>

From now, you can use the command sudo from your account.

How to automatically login as sudo user without password

However, you will still need to enter the password. So, to avoid this annoying requirement, you can edit /etc/sudoers and add this command at the end of the file:


%admin ALL=(ALL) NOPASSWD: ALL

Save and exit. Finally, you will also need to create the “admin group”:


groupadd admin

and again, you need to be part of the admin group. So type this command in a shell:

usermod -a -G admin <your username>

You should be able to use sudo without password from now on.

Please follow and like us:
This entry was posted in Linux and tagged , . Bookmark the permalink.

3 Responses to Fedora: how to add a sudo user (and avoid password)

  1. Under Fedora 21, it seems that this solution does not work anymore. A simpler solution found was as follows:

    edit /etc/sudoers and simply add :

    username ALL=(ALL) NOPASSWD: ALL

    replacing username with your login/username

  2. Under Fedora 23, no need to edit the /etc/sudoers file (which is read-oinly even for sudo user; if you really want to edit the sudoers file, use the tool called visudo). Just type this command in a shell:

    usermod your_login -a -G wheel

    and log off/ log in

Leave a Reply

Your email address will not be published.