We are going to use sftp
.
Connect to the remote using sftp:
sftp -i .ssh/id_rsa <remote_user>@<remote_host_ip_or_domain>
# for example
sftp -i .ssh/id_rsa ubuntu@crystalball.at
This will start an sftp session. Basically you have the local commands and the remote commands to change directories in order to select the source directory and the destination directory.
To copy a file you have locally named ~/hey/local.zip
to the remote directory /home/ubutu/Documents/local.zip
, do the following:
> cd /home/ubuntu/Documents
# send local.zip to remote
> put ~/hey/local.zip
> bye
to copy from the remote into the local do:
> lcd ~/hey/ALocalDir
# get remote.zip from remote and save to ~/hey/ALocalDir/
> get /home/ubuntu/Documents/remote.zip
> bye