Skip to content

Instantly share code, notes, and snippets.

@dan-mckay
Last active October 24, 2015 17:20
Show Gist options
  • Save dan-mckay/69bb4b745b1980cbe812 to your computer and use it in GitHub Desktop.
Save dan-mckay/69bb4b745b1980cbe812 to your computer and use it in GitHub Desktop.

Add User Linux

Add user called newuser, when logged in as root:

$ adduser newuser

To grant root privileges, open this file with default editor (nano):

/usr/sbin/visudo

Add the user’s name and the same permissions as root under the the user privilege specification

# User privilege specification
root    ALL=(ALL:ALL) ALL 
newuser	ALL=(ALL:ALL) ALL

Hit Ctrl+o to write your changes. It will ask to write to /etc/suders.tmp, change it to /etc/sudoers

Disable root login

Edit the following file

$ sudo vim /etc/ssh/sshd_config

edit thie following line from yes to no:

PermitRootLogin no

then restart ssh

$ sudo service ssh restart

Delete User

userdel newuser
rm -rf /home/newuser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment