SSH/SCP from the cli

  • by

SSH

ssh user@server-fqdn-or-ip

SCP

Get a file

scp user@server-fqdn-or-ip:/home/ubuntu/file-to-get.tar.gz local-save-to-dir

Send a file

scp .\file-to-send.tar.gz user@server-fqdn-or-ip:/remote/dir/

Connection with an explicit identity file

By default the commands try to use ~/.ssh/id_rsa as the identity file. If the file is located in a different place or has another name we can use the following parameter:

-i C:\Users\sij\.ssh\windows_id_rsa

SSH example

ssh -i C:\Users\sij\.ssh\windows_id_rsa user@server-fqdn-or-ip

SCP example

scp -i C:\Users\sij\.ssh\windows_id_rsa .\file-to-send.tar.gz user@server-fqdn-or-ip:/remote/dir/
Tags: