Useful ssh commands

Just a reference for myself ๐Ÿ™Š

ยท

1 min read

Create key:
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"

Add key to ssh-agent:
ssh-add ~/.ssh/id_rsa

Copy key to remote server:
ssh-copy-id -i ~/.ssh/mykey user@host

copy files over ssh

Local to remote:
scp -r /path/from/destination username@remotehost:/path/to/destination

Remote to local:
scp -r username@remotehost:/path/from/destination /path/to/destination

Local file to remote:
scp foobar.txt username@remotehost.edu:/some/remote/directory

ย