debian 8.1.0 jessie - sudo fix (not installed by default)
Debian seems to not have sudo installed by default.
Here is how to install sudo and add your username to the sudoers file.
=============================================
Color Key
=============================================
Things highlighted in yellow are commands to be executed in the terminal
Things highlighted in blue are to be clicked
Things highlighted in green are to be typed
Things highlighted in violet are to be pressed on the keyboard
Things highlighted in grey are showing output
Open the Terminal
- Click "Activities"
- Click in the "Type to search..." box
- Type in "Terminal" and press the [enter] key
Switch to root user
- Type in the Terminal the following command
su
- then press [enter]
- now type in the root password and press [enter]
- The command prompt should now look like this...
[email protected]:/home/yourusernamehere#
Install "sudo"
- Now that you are root user within the Terminal lets install "sudo"
- Type in the following command...
apt-get install sudo
- then press [enter]
Add your username to the sudo group
- Type in the following command...
adduser yourusernamehere sudo
- then press [enter]
Now add your name to /etc/sudoers file
- Type in the following command...
nano /etc/sudoers
- then press [enter]
- Scroll down and look for the line "%sudo ALL=(ALL:ALL) ALL"
- Below that line type in the following...
yourusernamehere ALL=(ALL:ALL) ALL
- Press "Ctrl+x" then press "y" and then press [enter] to exit and save the file
Now we exit out of the Terminal completely
- Type in the following command...
exit
- then press [enter]
- Type exit again...
exit
- then press [enter]
- That should have closed the Terminal application
Now let's open a new Terminal and test to see if sudo is working for your user name
- Click "Activities"
- Click in the "Type to search..." box
- Type in "Terminal" and press the [enter] key
- Test sudo by typing the following command...
sudo ls
- then press [enter]
- type in your password and press [enter]
- If the output looks like the following...
yourusernamehere is not in the sudoers file. This incident will be reported.
- then you might have to start from the beginning of these instructions and try again.
- If the output looks like this...
Desktop Documents Downloads Music Pictures Public Templates Videos
- Your username now has sudo rights, congratulations!
Enjoy!
To donate, please scan the QR code to the left or send bitcoins to the following address:
17ioPjLoCLDsUKwNpGV9dGtnLmpM8ioyUn

Comments
if you're going to use sudo the recommended way to edit the sudoers file is using visudo instead of nano. (https://wiki.debian.org/sudo)
It's also sometimes better to avoid sudo all together and just use su. (https://wiki.debian.org/Root)
You also don't actually need to edit the sudoers file, you can just add yourself to the sudo group.
su - && aptitude install sudo && adduser myusername sudo
after you're in the group you need to logout and back in then you're good.
I will try these tips the next time I work with a fresh copy of Jessie.
w
Thanks for this great solution
greetings from Hans (The Netherlands)
Thanks
@WinstonSmith
Ideally /etc/sudoers.d/ should be used for maximum portability -- and incidentally avoid messing up with the main configuration file.
Another good practice when working as root is to start with an as much as possible clean environment so $ su - would fit best on most situations.
HTH