I have 2 computers with Linux, how can I send with ftp files from computer1 to computer2 (shell command)?

7,262

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.

Share:
7,262

Related videos on Youtube

Ben
Author by

Ben

Updated on September 17, 2022

Comments

  • Ben
    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):

    1. Find inner IP address of computer1
    2. Open the ftp port (21) of computer1 (make computer1 ftp server)
    3. Send file from computer2 to computer1 with shell command

    My setup:

    1. router+modem
    2. computer1 running Linux
    3. computer2 running Linux
    • D'Arvit
      D'Arvit almost 14 years
      Does you use DHCP? What model is your router?
  • charlesbridge
    charlesbridge almost 14 years
    sftp is probably available too. Just like FTP, only pushed through SSH connection
  • Ben
    Ben almost 14 years
    Thanks, but first i need to find computer1 ip.I have to do that with ftp or sftp
  • Jarvin
    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
    David Z almost 14 years
    @Mitch: I'd recommend changing ifconfig eth1 to just ifconfig (or ip addr works too) because we don't know what interface is exposed on meyosef's computers. (but +1 anyway)
  • Mitch
    Mitch almost 14 years
    +1 ip addr is easy, this is the first I've heard of it.
  • Ben
    Ben almost 14 years
    How 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
    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.