We can copy from and copy to a remote server using scp command. scp means secure copy. The structure of the command is as follows:
scp source destination
Suppose I want to copy to 192.168.100.5 . We want to copy the /etc/passwd to the remote server at /root .
Then we have to use the following command:
scp /etc/passwd root@192.168.100.5:/root
If we want to copy from 192.168.100.5 /etc/passwd file to /root, then we will write
scp root@192.168.100.5:/etc/passwd /root
We have to remind one thing that we must have to use root user for secure copy.
To copy a folder we have to use the following structure:
scp -r source destination