Skip to content

Setup An Ubuntu Vps Quickly

Setup and secure an Ubuntu VPS Quickly#

Quick guide to setting up a virtual private server quickly

After creating a server

  1. Login as root

    ssh root@

  2. Update and upgrade

    sudo apt update sudo apt upgrade

  3. Create a user

    adduser newuser

  4. Add user to the sudo group

    usermod -aG sudo newuser

  5. Become the new user

    sudo su newuser -

  6. Create an ssh key

    ssh-keygen -t rsa -b 4096 -C “”

  7. logout of the server


  8. On your local machine, copy your ssh key to the new user on the server

    ssh-copy-id newuser@

  9. Test log in

    ssh newuser@

  10. Disable password auth

    vim /etc/ssh/sshd_config


PasswordAuthentication no
  1. Reload ssh

    sudo systemctl reload sshd

  2. Allow ssh and enable the ufw (uncomplicated firewall) firewall

    sudo ufw app list sudo ufw allow OpenSSH sudo ufw enable

Add the server to your ssh config for easy ssh#

vim ~/.ssh/config


Host newserver
    Port 22
    User newuser
    IdentityFile ~/.ssh/id_rsa
    IdentitiesOnly yes


source ~/.bashrc

Now you can ssh into the server with:

ssh newserver