Skip to content

Instantly share code, notes, and snippets.

@Ruzzz Ruzzz/ssh_vps_access.sh
Last active Dec 1, 2019

Embed
What would you like to do?
# On remote host do:
# ------------------
# Add user
sudo adduser <USER> sudo
# Or:
sudo adduser <USER>
sudo usermod -a -G sudo <USER>
# Change ssh configuration
sudo nano /etc/ssh/sshd_config
# Port NNN
# PermitRootLogin no
# AllowUsers <USER>
sudo service ssh reload
# On local host do:
# ------------------
# Generate key
ssh-keygen -t rsa -b 4096 -f <KEY_FILE>
# Copy public key to remote host
ssh-copy-id -i <KEY_FILE> <USER>@<HOST>
# Connect to remote host
ssh -i <KEY_FILE> <USER>@<HOST>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.