I have 2 computers with Linux, how can I send with ftp files from computer1 to computer2 (shell command)?
Solution 1
Step 1: you can type ip addr
from either computer to get its IP. If they are on the same link (both inside the router) and you have avahi on both, you can refer to them as <short-hostname>.local instead of using an ip.
Step 2 is installing openssh-server
on one machine, step 3 is running scp from the other. The Nautilus file manager has ssh/scp integration if you like; you can use the “connect to server” menu for that.
Another option is installing gnome-user-share
on the server, configuring it from the menus or gnome-file-share-properties
, and finding the server from the other computer in Nautilus's network folder.
Solution 2
To get the ip of computer1 if you have access to computer1 type this: ifconfig
Assuming you have SSHD running on both machines, I would use SCP or rsync over ftp. for scp the command is simply
scp /path/to/file username@ipremotemachine:/path/to/copy/to
And for rsync
rsync /path/to/file ipremotemachine:/path/to/copy
But since you asked about ftp simply type:
ftp remoteip
It will ask for username password, then you have to use the ftp client.
man ftp
will give you more information. But honestly If you are doing simple file moves I would highly recommend scp, or rsync.
Related videos on Youtube
Ben
Updated on September 17, 2022Comments
-
Ben over 1 year
I have 2 computers with Linux. How can I send with ftp files from computer1 to computer2 them (shell command)?
Steps that I think should be done (miss shell commands):
- Find inner IP address of computer1
- Open the ftp port (21) of computer1 (make computer1 ftp server)
- Send file from computer2 to computer1 with shell command
My setup:
- router+modem
- computer1 running Linux
- computer2 running Linux
-
D'Arvit almost 14 yearsDoes you use DHCP? What model is your router?
-
charlesbridge almost 14 yearssftp is probably available too. Just like FTP, only pushed through SSH connection
-
Ben almost 14 yearsThanks, but first i need to find computer1 ip.I have to do that with ftp or sftp
-
Jarvin almost 14 years@meyosef: You can't find the IP of computer1 using ftp, because ftp requires the IP of the destination computer to use it. If you can type commands on computer1, you can find the IP by typing the command
ifconfig
-
David Z almost 14 years@Mitch: I'd recommend changing
ifconfig eth1
to justifconfig
(orip addr
works too) because we don't know what interface is exposed on meyosef's computers. (but +1 anyway) -
Mitch almost 14 years+1 ip addr is easy, this is the first I've heard of it.
-
Ben almost 14 yearsHow I can find computer1 ip only with computer2 when i know that exist only 2computers? (I want to get all host when computer2 ip i simply find with ifconfig )
-
Mitch almost 14 years@meyosef if you only have 2 computers behind your router and you are using dhcp it is probably +/- one ip address from the ip address of computer2, but you are going to need physical access (or ssh) to setup the required services.