Linux – Directly connecting a computer and a server over an Ethernet cable is not working as expected

ethernetlinux

I'm trying to transfer some files over Ethernet and figured that conncting my headless server directly to my computer with an Ethernet cable would be the fastest method. However, things don't go quite well.

I can only acces this to server over SSH, thus requiring a connection which I first need to create myself, apparently. I have found that I need to make a connection with the option “shared to other computers.” This will then act as a router and assign IP adresses. I did this but now I dont know what IPs are used or how to find them.

The server is has FTP set up. It’s this which I want to use to transfer my files. I need an IP adress for this but don't know how to set it up over a direct connection.

Both computers run Debian and I can only acces one of them. Is there a simple solution or perhaps a better way to do this?

Best Answer

Figure out what IP addresses are being used.

The IP addresses assigned to all interfaces:

ifconfig 

Or just get the IP address for one, specific interface like this:

ifconfig eth0

Will give you the assigned IP address.

Assign your own IP address.

Additional you can assign the IP address

On computer 1:

ifconfig eth0 192.168.75.1/24

On computer 2:

ifconfig eth0 192.168.75.2/24

You need to replace the eth0 with the name of your interface.

Additionally you may need to examine the firewall to make sure its isn't going to block your traffic.

iptables --list will tell you want firewall rules are being enforced.

Try using Samba.

I recommend you give up on clunky protocols, and install and configure samba on both computers. You may then simply use the cp command or etc to move files around.

Using samba you only need this on the client side:

mount  -o username=username,password=password //<ip address>/sharename /mountpoint

On the server side you need to configure the smb.conf file found either in /etc/smb.conf or /etc/samba/smb.conf

Also setup a user account

smbpasswd -a username
  • Enter password.
  • Confirm password.

Now you have valid credentials to login to the server.

Or use SCP instead.

Even scp is better idea than FTP. This uses the SSH protocol to transfer files. Follows the standard source destination format that the cp command uses.

scp root@<ip address>:/etc/ntp.conf .
Related Question