Skip to content

Instantly share code, notes, and snippets.

@Ruzzz
Last active December 1, 2019 05:49
Show Gist options
  • Save Ruzzz/2504881170e8e72ba05e9bfc990c4bfe to your computer and use it in GitHub Desktop.
Save Ruzzz/2504881170e8e72ba05e9bfc990c4bfe to your computer and use it in GitHub Desktop.
# 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