Use scp command for general file sharing
Please review the post Configuring ssh on linux in order to be able to follow along. This way you will have access to an ssh server.
Some useful commands
Lets generate some handy shell scripts that can be reused across the terminal (from any directory). Be sure to move the shell scripts to /usr/local/bin.
.
├── cat_remote.sh
├── download_remote.sh
├── list_remote.sh
└── upload_remote.sh
cat_remote.sh
#!/bin/bash
ssh -i ~/.ssh/id_private_key root@ip_or_host cat "$1"
sample usage: cat_remote.sh /root/envs.txt This command simply prints the contents of the remote file /root/envs.txt
download_remote.sh
#!/bin/bash
scp -i ~/.ssh/id_private_key root@ip_or_host:"$1" "$2"
sample usage: download_remote.sh /root/envs.txt ~/Desktop/envs1.txt This command downloads the remote file /root/envs.txt to ~/Desktop/envs1.txt
list_remote.sh
#!/bin/bash
ssh -i ~/.ssh/id_private_key root@ip_or_host ls -la "$1"
sample usage: list_remote.sh /root This command list the contents of the remote directory /root
upload_remote.sh
#!/bin/bash
scp -i ~/.ssh/id_private_key "$1" root@ip_or_host:"$2"
sample usage: upload_remote.sh ~/Downloads/envs.txt /root This command copies the file ~/Downloads/envs.txt to remote folder /root