How To Connect Two Ubuntu Computers Via Lan Cable

How do I connect two computers with Ubuntu?

To connect two computer’s with a LAN cable in ubuntu “you’ll need a crossover network cable and have to do a few manual things in network connection settings.

How to Connect Two Ubuntu Machines Via Lan Cable?

You will need to manually assign an IP address in the same range. The following steps assume you are using the standard Unity interface. Repeat these steps for each computer machine.

  • Click the Network indicator on the Unity panel (top right).
  • From the drop-down, select Edit Connections…
Click on Add
  • In the Network Connections dialog box, click the Add button.
  • When prompted to choose a connection type, choose Ethernet, and click the Create… button.
Choose Connection Type
  • Name your connection “Lan A” to differentiate from a typical Ethernet connection.
Renaming Ethernet Connection
  • Switch to the IPv4 Settings tab.
Choose Manual Addressing
  • Change the Method to Manual.
  • Click the Add button to add an IP address.
Giving Manual Addressing To “Machine A”

Do the same process above to “Machine B” & edit the IP last one digit as shown below in examples:

  • Example settings for Machine #A:
    • Address:
    • Netmask:
    • Gateway:
  • Example settings for Machine #B:
    • Address:
    • Netmask:
    • Gateway:

The addresses and cannot talk to each other if you use the subnet Notice the third octet (number) of your IP addresses is different, in the answer you linked to they are the same.

After Giving settings to both machines, you need to check if they are pinging each other. Open the terminal in Machine A and give the command “ping“, and you’ll see the successful connection between “Machine A” & “Machine B”. Now next step is to share files between them.

How To Share Files Between Two Ubuntu Machines Via Lan Cable?

To share files on any network you’ll need a file-sharing software “samba“, you have to install samba manually. It’s not come in any version of ubuntu Pre-Installed.

  1. Open Terminal by pressing keys “CTRL+ALT+T”.
  2. Enter the command below
sudo apt install samba
Install Command For Samba
  • 3. Then type the password for the user and hit enter.
Installing Samba

After completing this samba will be successfully installed on your machine. Do the same steps on both machines. Now time to create a username and password for file transmission and bypass in samba file sharing.

How to Create Samba Username And Password?

Enter the following commands on both machines under different conditions. Choose two usernames for both machines, like for “Machine A” username is “mac1” and for “Machine B” username is “mac2“. But here I am using hpoo61 for my computer machine.

  • 1. Open Terminal by pressing keys “CTRL+ALT+T”.
  • 2. enter the command below
sudo smbpasswd -a "username"

Here I am using “hp0061” as my username. you can replace it with your own.

  • 3. Enter a new password for user “hp0061” And then retype your password again & press enter.
Username & Password Created Successfully

After creating a username and password for the samba file sharing tool, now it’s time to share files from one ubuntu machine to another ubuntu machine.

Share & Transfer Files between 2 Ubuntu Computers.

How can I transfer data from one laptop to another using a LAN cable in Ubuntu?

First, you have to choose a folder or directory of which you want to share files to another machine. Open that folder and do the following steps:

  • 1. Click Right-Click and Open “Properties” of that folder.
Samba Folder Share Properties
  • 2. Go to the “Local Network Share” tab
  • 3. Click & Check to the “Share this folder” & enter share name of the folder.
  • 4. Click & Check to the “Allow others to create and delete files in this folder“.
  • 5. Now click “Create Share
Creating Share
  • 6. Now click “Add the permissions automatically”.
Add Permissions To Samba Share

The file share is successfully created you can modify these settings later anytime.


Now if the folder share is created on “Machine A” you can access that folder from “Machine B” with the following steps given below. And if you want to access the data from “Machine B” To “Machine A” so you have to create the folder share from Machine B with the same steps given above.

  • 1. Go to “Files
  • 2. Click on “Connect to server
  • 3. Enter the IP Address of Machine you want to connect “smb://____/”
Connecting Local IP Samba Share
  • 4. Now click “Connect
Connecting As User
  • 5. Enter the Username, Domain and Password & then click “Connect“.

Here you have to enter the Username and Password of the Computer Machine that you want to connect to. For example, if you are trying to access “Machine B” files from “Machine A” then you have to enter the Username & Password of Machine B”

Network Share Success

Here’s the “Connect Two Ubuntu Computers Via Lan” Connection Successfully Established & File Sharing Access from one Computer Machine To Another Computer Machine Via Lan Cable In Ubuntu Linux.

Also, check related to this:

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.