Skip to content

Instantly share code, notes, and snippets.

@1901
Last active March 30, 2022 17:31
Show Gist options
  • Save 1901/de89d95a5832fc92e5fb93a4c5f0fb49 to your computer and use it in GitHub Desktop.
Save 1901/de89d95a5832fc92e5fb93a4c5f0fb49 to your computer and use it in GitHub Desktop.
[SSH commands] #ssh #linux
# ssh to host
ssh user@hostname
# generate ssh key
ssh-keygen -t rsa -C "kaixuan@example.com"
# copy local ssh public key to remote host
ssh-copy-id user@hostname
# add private key to ssh-agent
ssh-add ~/.ssh/id_rsa_github
# remove hostname from known_hosts list
ssh-keygen -f ~/.ssh/known_hosts -R hostname
# Mount remote directory
sshfs user@hostname:remote_directory mountpoint
# Unmount remote directory
umount mountpoint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment