Page Contents
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…

- In the Network Connections dialog box, click the Add button.
- When prompted to choose a connection type, choose Ethernet, and click the Create… button.

- Name your connection “Lan A” to differentiate from a typical Ethernet connection.

- Switch to the IPv4 Settings tab.

- Change the Method to Manual.
- Click the Add button to add an IP address.

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: 192.168.0.11
- Netmask: 255.255.255.0
- Gateway: 192.168.0.1
- Example settings for Machine #B:
- Address: 192.168.0.22
- Netmask: 255.255.255.0
- Gateway: 192.168.0.1
The addresses 192.168.0.11 and 192.168.0.22 cannot talk to each other if you use the subnet 255.255.255.0. 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 192.168.0.22“, 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.
- Open Terminal by pressing keys “CTRL+ALT+T”.
- Enter the command below
sudo apt install samba

- 3. Then type the password for the user and hit enter.

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.

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.

- 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“

- 6. Now click “Add the permissions automatically”.

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://____/”
smb://ip-address/

- 4. Now click “Connect“

- 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”

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:
- How to Install And Convert Videos with Transmageddon in Linux.
- Best Way To Transfer Data Between Two Computers.