If you want to copy a file from one LINUX machine to another using scp (Secure CoPy), the following is for you. Secure-copy is pre-installed on every LINUX machine, and its syntax is quite similar to normal copy via cp.
Imagine your computer is A, and you want to copy your local myfile to computer B into directory /home/user/. Both machines are up and running and connected to the same router/modem by cable or WIFI (wireless).
-
Go to computer B. You can find out its IP-address by typing
ifconfig | awk '/broadcast/ { print $2 }' # or: hostname -Iin a command-line window. Let's assume the IP-address of B is 192.168.0.123. -
Then you need the name of the user on B for whom you want to copy the file.
id | awk '{ print $1 }'This gives you the name of the user (in parentheses). Let's assume it is yourusername. Mind that you also need to know the password of that user on B, and that user must have write-privileges in the copy-target directory (/home/user/). - Computer B must have an ssh server (service) installed and running.
Check this by typing
systemctl list-units --type service | grep ssh
If you see no line like "ssh-service loaded active running ...", typesudo apt-get install openssh-server
and enter the superuser-password, needed to install system-wide software. After that, the service should be up and running, check it again with systemctl. - Now go to computer A.
Open a command-line window and change to the directory where myfile is. Then type
scp myfile yourusername@192.168.0.123:/home/user/
You will be asked to input the password of yourusername on computer B. Enter it and press RETURN. - A progress indication will be displayed on the command-line for the time of copying.
Finally check if the file arrived on computer B by going there and typing
ls -l /home/user/myfile
I hope it will work for you as good as it worked for me!
If you prefer to do the copy with the graphical user-interface GNOME-Files (Nautilus?), you can use the input field on bottom of that file-browser:
With all that confusing artificial-intelligence on the web that offer you so many ways to do a file transfer, I felt the need to write down how simple it can be. Moreover it took me a while to find out the shortest way (samba is nice but more complicated!).


Keine Kommentare:
Kommentar veröffentlichen