How to enable sudo on your Linux system with the visudo command.

The visudo command for Linux allows a user to edit the sudoers file and change permissions for users on the system.

Open the sudoers file this way. NEVER edit it with a standard text editor.

┌─[[email protected]]─[~]
└──╼ $su
[email protected]:/home/jason# visudo

This is the result of my editing. I have added the user jason to the sudoers file.

  GNU nano 2.2.6                               File: /etc/sudoers.tmp                                                          Modified  

# 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
jason   ALL=(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

This means that the user jason may now use the sudo command to gain superuser privileges and run commands requiring root access. This is how easy it is to add this to a Debian system, but other Linux distributions will work as well.

No comments have been made. Use this form to start the conversation :)

Leave a Reply