Skip to content

Instantly share code, notes, and snippets.

@davebeach
Last active November 20, 2016 21:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davebeach/051a2770dba77d0ecd2c0d9aab0eb350 to your computer and use it in GitHub Desktop.
Save davebeach/051a2770dba77d0ecd2c0d9aab0eb350 to your computer and use it in GitHub Desktop.
SSH Commands

Misc Commands

  • To remove a entry from Known_hosts in .ssh directory
ssh-keygen -R hostname
ssh-keygen -F myhost         # shows myhosts's line in the known_hosts file
ssh-keygen -l -F myhost      # additionally shows myhost's fingerprint
ssh-keygen -R myhost         # remove myhost's line from known_hosts
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

To clear ACL on files:

chmod -R -a# 0 ~/.ssh

For config changes, to restart:

sudo /etc/init.d/sshd restart

Restart SSH:

invoke-rc.d ssh restart

scp $source_file $remote_user@$remote_host:$destination_file // to send scp $remote_user@$remote_host:$source_file $destination_file // to receive

Open SSH Agent

eval ssh-agent -s

Add key to Agent

ssh-add $private_key

Delete all Agent Memory:

ssh-add -l // to list ssh-add -D // to delete

Run single command on server ssh $remote_user@$remote_host 'ls *.txt'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment