[ Prev ] [ Index ] [ Next ]

sudo

Created Friday 30 December 2016


By default, you aren't allowed to use the sudo command as a user.
Further more, running X applications with sudo is not possible by default.
This is because, that root does not have access to the primary screen by default.


# The sudoers configuration file is located at /etc/sudoers.
# This file should always be edited with the visudo editor.
$ EDITOR=nano visudo


Enable user to use sudo

# Edit the sudoers file
$ EDITOR=nano visudo


# And add the user

stick ALL=(ALL) ALL



Allow sudo to use X applications

# Edit /etc/profile and add the following line - remember to change username

export XAUTHORITY=/home/<username>/.Xauthority



Tips and Tricks

# Some random Tips and Tricks


Change password timeout

# The default lets you use sudo commands in a 5min time span
# Let's change this to 30 - I am a bit slow sometimes..
$ EDITOR=vim sudo visudo


# And add the following

Defaults:stick timestamp_timeout=30


Insult when the wrong password was entered

# Add this line to the sudoers file

Defaults	insults


Disable password for user

# Be aware that this is not good practice
# Add to the sudoer file - change USER_NAME accordingly

Defaults:USER_NAME      !authenticate