Skip to content

Instantly share code, notes, and snippets.

@panduroab
Last active March 7, 2016 21:01
Show Gist options
  • Select an option

  • Save panduroab/9e10f46f35cda441372f to your computer and use it in GitHub Desktop.

Select an option

Save panduroab/9e10f46f35cda441372f to your computer and use it in GitHub Desktop.

Access to the server

ssh root@VPS_PUBLIC_IP

Create a new User

adduser usrexample

Root privileges

gpasswd -a usrexample sudo

SSH public key athentication

Local

ssh-keygen

cat ~/.ssh/id_rsa.pub

Server

su usrexample

mkdir .ssh
chmod 700 .ssh

vi .ssh/authorized_keys
chmod 600 .ssh/authorized_keys

Disable root login through SSH

vi /etc/ssh/sshd_config
PermitRootLogin yes --> PermitRootLogin no

service ssh restart

ssh usrexample@VPS_PUBLIC_IP

exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment