Posted: . At: 3:03 PM. This was 7 years ago. Post ID: 10240
Page permalink. WordPress uses cookies, or tiny pieces of information stored on your computer, to verify who you are. There are cookies for logged in users and for commenters.
These cookies expire two weeks after they are set.


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.

┌─[jason@neo][~]
└──╼ $su
Password: 
root@neo:/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.


Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.