Transfer files from unix machines.
In this example, we have setup the credentials for our remote server with the alias of xwing. This allows us to connect to the server without having to type all the credentials every time.
You just simply connect by typing: ssh xwing
We don't need to login before we run the scp
command, so let's logout and setup the ssh config.
Type exit
to logout.
You can open this file with your favorite editor, just type code, atom or sublime instead of nano.
nano ~/.ssh/config
Host *
AddKeysToAgent yes
UseKeychain yes
IdentityFile ~/.ssh/id_rsa
Host xwing
Hostname insert_ip_address
User insert_username
IdentityFile ~/.ssh/your_key_file_here.pem
If you haven't setup your ssh-keys correctly before, follow this guide: SSH setup
scp my-file.txt xwing:/var/www/my-project
scp -r my-folder xwing:/var/www/my-project
scp xwing:/var/www/my-project/my-file.txt /local/path
scp xwing:/var/www/my-project/my-file.txt xwing2:/var/www/my-project-2