LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Transferring files between boxes (https://www.linuxquestions.org/questions/linux-networking-3/transferring-files-between-boxes-497617/)

Kodiak_Claw 11-01-2006 02:00 PM

Transferring files between boxes
 
I'm trying to transfer my data files from one computer to another. Since the older machine lacks a means of mass storage, I've bought an ethernet cable, and am hoping I can get them to network.

The older box is Fedora Core 5, while the newer one is Slackware 10.2.

About the only thing I know here is that I need the ethernet cable (and the ethernet cards, I have those too), so feel free to include details that 'anybody should know'.

jschiwal 11-01-2006 02:17 PM

If you don't have a hub or switch, then you need a crossover ethernet cable. If the hosts are not next to each other and you don't want to go out and buy a 25 or 50 ft crossover cable, you can buy a shorter one and an ethernet extension adaptor.
You could either set up a networking share, using NFS or samba, or you could use the sftp program. For that you need to set up ssh which is easier than setting up a ftp server.

osvaldomarques 11-04-2006 08:07 AM

Supposing you already have the crossover cable to connect both machines, you need to see if both machines have their ethernet interfaces configured in the same network.
You need to enter the command "ifconfig eth0" on both machines; the answer will be something like above:
Code:

eth0      Link encap:Ethernet  HWaddr 00:14:2A:D6:CC:C6
          inet addr:192.168.0.1  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:23 Base address:0xe400

You have to be sure that both machines are in the same network, that is, 192.168.0.x but have different addresses, for instance, one should be 192.168.0.1 and the other 192.168.0.2.

If you don't have it on this condition, you can setup the network with the above commands, one for each machine:
Code:

# Machine A
ifconfig eth0 192.168.0.1 netmask 255.255.255.0 broadcast 192.168.0.255

# Machine B
ifconfig eth0 192.168.0.2 netmask 255.255.255.0 broadcast 192.168.0.255

These configuration will not be preserved on the boot. If you want to preserve configuration, on the fedora enter "netconfig" to setup the addresses and on the slackware, edit /etc/rc.d/rc.inet1.conf to specify the addresses.

When the configurations seem Ok, you can ping each other to see if the machines are really connected:
Code:

# Machine A
ping 192.168.0.2

# Machine B
ping 192.168.0.1

If it's all working, you will see a sequence like the above:
Code:

PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data.
64 bytes from 192.168.0.2: icmp_seq=0 ttl=64 time=0.066 ms
64 bytes from 192.168.0.2: icmp_seq=1 ttl=64 time=0.057 ms
64 bytes from 192.168.0.2: icmp_seq=2 ttl=64 time=0.059 ms

Hit Ctrl-c to finish ping.

Now you need some kind of remote shell in both machines, like ssh or rsh. I don't want to setup flames here, but for a local network, I prefer rsh; however, you should already have ssh installed on both machines; you need at least one with ssh which is the client and the other with sshd, the ssh server. You can check if both are installed with the command:
Code:

which ssh
which sshd

If you have it installed, you will see the absolute path of the files ssh and sshd. If you have no answer from the command, you need to intall and configure the packages on both machines. The problem with ssh is that it's strongly recommended to do not permit open sessions with root user and doing this, you can't transfer all file attributes when transfering files from one machine to another, unless you set "user id" execution bit on the application, but we'll discuss it later.

To check if the connection is working, from one machine, open a session on the other:
Code:

# Machine A
ssh <user name>@192.168.0.2

# Machine B
ssh <user name>@192.168.0.1

If both clients and server are working, you'll get a password prompt and, after enter the proper password, you'll get a shell prompt on the other system. The <user name> is a valid user name on the target machine and must not be "root".

All right, now we can think on the transfer issues. You can use scp, which comes with ssh. There are other utilities and forms to do the transfer over the ssh but I guess that scp is enough for now. The command will be:

scp <file name> <user name>@192.168.0.2:/<directory name>/
scp will ask the password before transfer the file.

tredegar 11-04-2006 10:19 AM

Good advice so far. But once you have the connection working, if you're running KDE, there's a neat protocol built into konqueror - fish which gives you a neat graphical way of moving files between machines.

Put the following in your konqueror location bar and press return:

fish://username@addy.of.other.machine

and off you go! You can drag & drop files between machines as easily as you can between directories on your own machine.

Edit: Note that for fish to work, you need to have ssh running!

HTH

HeyAZ 12-17-2006 03:17 PM

can't get ssh to work
 
Want to transfer files from a Fedora Core 5 desktop (address 192.168.1.3 and the user-name: jb) to a Suse 10.2 laptop (192.168.1.4, jim). Connect with a crossover cable. Same broadcast: 192.168.1.255.

Ping works from the laptop but ssh cannot connect:
# ping 192.168.1.3
PING 192.168.1.3 (192.168.1.3) 56(84) bytes of data.
64 bytes from 192.168.1.3: icmp_seq=1 ttl=64 time=0.163 ms
64 bytes from 192.168.1.3: icmp_seq=2 ttl=64 time=0.180 ms
64 bytes from 192.168.1.3: icmp_seq=3 ttl=64 time=0.179 ms
--- 192.168.1.3 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.163/0.174/0.180/0.007 ms
# ssh jb@192.168.1.3
ssh: connect to host 192.168.1.3 port 22: No route to host

From the desktop can also ping, but then hangs:
#ssh: connect to host 192.168.1.4 port 22: Connection timed out

^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Diagnostics:

On laptop:
# nmap -T5 -sV localhost
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2006-12-17 13:02 MST
Interesting ports on localhost (127.0.0.1):
Not shown: 1675 closed ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 4.4 (protocol 1.99)
25/tcp open smtp Postfix smtpd
111/tcp open rpc
631/tcp open ipp CUPS 1.2
6000/tcp open X11 (access denied)
Service Info: Host: linux-arizona.site; OS: Unix
Nmap finished: 1 IP address (1 host up) scanned in 6.270 seconds
# /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
# ps aux | grep sshd
root 3619 0.0 0.1 53460 1528 ? Ss Dec16 0:00 /usr/sbin/sshd -o PidFile=/var/run/sshd.init.pid
root 9721 0.0 0.0 5008 796 pts/0 S+ 13:10 0:00 grep sshd

On the desktop, nmap shows port 22 is also open:
22/tcp open ssh OpenSSH 4.4 (protocol 2.0)
# /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
# ps aux | grep sshd
root 2255 0.0 0.1 4976 1108 ? Ss 02:04 0:00 /usr/sbin/sshd
root 25016 0.0 0.0 3916 656 pts/0 R+ 13:11 0:00 grep sshd

HeyAZ 12-17-2006 09:48 PM

OK - got it working. One thing about that Suse firewall: it does work !
Thanks for advice, using fish in the konqueror location bar helps tremendously.
:-)


All times are GMT -5. The time now is 10:16 PM.