How to enable sudo on Debian 7.0 with the visudo command.

Posted: May 9, 2013. At: 9:56 PM. This was 5 years ago. Post ID: 5717
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.

The visudo command is used on Linux systems to edit the /etc/sudoers file; this ensures that there are no errors before the changes are written to the actual file. As you can see below; I have added my user homer to the sudoers file. This allows me to run commands with sudo; but will still ask for my users password before running the command.

#
# 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
 
# Allow members of group sudo to execute any command
%sudo	ALL=(ALL:ALL) ALL
homer ALL=(ALL:ALL) ALL
 
# See sudoers(5) for more information on "#include" directives:
 
#includedir /etc/sudoers.d

This is how you enable the sudo command for the normal user on Debian GNU/Linux 7.0. This is not very difficult at all; just make sure you NEVER edit the /etc/sudoers file with any other editor. Use the visudo command.

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

Leave a Reply