Skip to content

Instantly share code, notes, and snippets.

@ErnHem
Last active August 14, 2018 10:35
Show Gist options
  • Select an option

  • Save ErnHem/ee37b479ab9a583b181024d8f033ea20 to your computer and use it in GitHub Desktop.

Select an option

Save ErnHem/ee37b479ab9a583b181024d8f033ea20 to your computer and use it in GitHub Desktop.
*server*
useradd username
passwd username
su username
*host*
cat ~/.ssh/id_rsa.pub | ssh username@remote_host "mkdir -p ~/.ssh && touch ~/.ssh/authorized_keys && chmod -R go= ~/.ssh && cat >> ~/.ssh/authorized_keys"
*Disable Password Authentication on your Server*
sudo vi /etc/ssh/sshd_config
...
PasswordAuthentication no
PubkeyAuthentication yes
...
sudo systemctl restart sshd.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment