Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save omargourari/f318b4209f18d4cab474 to your computer and use it in GitHub Desktop.
Save omargourari/f318b4209f18d4cab474 to your computer and use it in GitHub Desktop.
Initial Server Setup with Ubuntu 14.04

$local = operations launched in the local machine $server = operations launched in the vps


1. Create a New User

$server adduser example_user

and add the relative Bedrock installation sudoer passwords

2. Root Privileges

$server gpasswd -a example_user sudo

3. Add Public Key Authentication (Recommended)

$local ssh-keygen
$local cat ~/.ssh/id_rsa.pub
$server mkdir /home/example_user/.ssh
$server chmod 700 /home/example_user/.ssh
$server vi home/example_user/.ssh/authorized_keys

and paste your public_key content to the authorized_keys file.

4. Add the right permission to the newly created user

visudo

Comment all existing user/group grant lines and add:

root    ALL=(ALL) ALL
example_user  ALL=(ALL) ALL

The above grants sudo access to the example_user user when they enter the proper password.

5. Configure SSH Daemon

$server nano /etc/ssh/sshd_config

and change the following line :

PermitRootLogin yes --> PermitRootLogin no 
PasswordAuthentication yes --> PasswordAuthentication yes

6. Reload ssh

$server service ssh restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment