Scp is useful in conjunction with tar. It allows you to securely copy a file from one server to another. To do this you must know the address of your destination server and you must have a username and password for a user with write privileges in the location you want to put the file. For this example, say I want to move that tarball I created earlier to a server â€˜someserver.comâ€™ and I have write privileges with the user â€˜myuserâ€™ and password â€˜mypasswordâ€™:
scp mytarball.tgz email@example.com:/home/myuser
You would then be prompted for the password of â€˜myuserâ€™. This would copy the file to the directory /home/myuser on the host server. If you were on the host server already and wanted to copy a file from a remote server you would do:
scp firstname.lastname@example.org:/home/anotheruser/filetocopy.txt .
You would then be prompted for that users password. This would copy the file â€˜filetocopy.txtâ€™ from a remote server to your current director. This is essentially â€˜gettingâ€™ a file whereas the first example was â€˜puttingâ€™ a file.