Skip to content

Instantly share code, notes, and snippets.

@Skylarity
Last active June 20, 2017 18:46
Show Gist options
  • Save Skylarity/efd50fbc9b9400e3dcd699a4fc4ad1cd to your computer and use it in GitHub Desktop.
Save Skylarity/efd50fbc9b9400e3dcd699a4fc4ad1cd to your computer and use it in GitHub Desktop.
Adding User Accounts on a Server

Adding Users

As any user:

-G sudo gives user sudo privileges, omit this for users who do not need this

$ sudo useradd -m -c "Firstname Lastname" -g users -G sudo username_here

Create password for sudo privileges

$ passwd username_here

If the user is not physically present to type in a password, set the password to something stupid, and expire the password so it needs to be changed upon next login.

$ passwd username_here
$ chage -d 0 username_here

As username_here:

Add SSH key(s)

$ mkdir ~/.ssh
$ vim ~/.ssh authorized_keys

Paste SSH key(s) here and save

$ chmod 700 .
$ chmod 600 authorized_keys
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment