Copying Files from Local Machine to Remote Server via Command

Nowadays, playing with remote servers is one of the great skills which is necessary for all kinds of developers especially full-stack ones and while with them, there is one problem which every person will face which is Sharing data from your local system to remote server. For instance, It can be some already created or downloaded scripts that you may want to execute on remote server. The one option is to push your scripts on Github and then clone them over remote servers which works fine, or better we may use an FTP Client like FileZilla but there is another tool that we can use much more efficiently and it is totally secure using your local system terminal. SCP (Secure Copy Protocol) or secure copy allows secure transferring of files between a local host and a remote host. It uses the same authentication and security as the Secure Shell (SSH) protocol from which it is based. SCP is loved for its simplicity, security and pre-installed availability.

The syntax for scp is:

scp /file/to/send username@remote:/where/to/put

Here the
username - remote username
remote - can be an FQDN or an IP address.

If you are on the computer from which you want to send a file to a remote computer:

scp /file/to/send username@remote:/where/to/put

mahesh@mahesh-server:~$ scp /home/mahesh/image.jpg root@

If you are on the computer want to receive a file from a remote computer:

scp username@remote:/file/to/send /where/to/put

mahesh@mahesh-server:~$ scp root@ /home/mahesh/Downloads

scp can also send files between two remote hosts:

scp username@remote_1:/file/to/send username@remote_2:/where/to/put

mahesh@mahesh-server:~$ scp root@ root@

0 Komentar