Monday, 8 July 2013

How to add a user to the sudoers file in Linux (to give root permissions)

Assuming you have access to the root account...
Change to root user and then open the sudoers file.
su root
vi /etc/sudoers
Scroll to line that says
root ALL=(ALL:ALL) ALL
Copy this line and change the 'root' to the desired username
Save file and exit vi
Exit root
Now your user should be able to use sudo
For example, to get the latest packages in your package manager
sudo app-get update
This was tested with Debian 7.7. Should work with other distros that use the apt package manager e.g. Ubuntu.

No comments:

Post a Comment