Sharing Files Between Linux Systems

Sharing Files Between Linux Systems

Table of Contents

How to share files between 2 linux distros over LAN?

Following this article.

Step 1: Create a LAN.

  • PC 1
  • PC 2
  • Connect these two systems with LAN Cable.

Step 1.1: Give IP addresses:

  • PC 1:

    • IP: 192.168.2.1
    • Gateway: 192.168.2.2
  • PC 2:

    • IP: 192.168.2.2
    • Gateway: 192.168.2.1

Step 1.2: Ping each other systems.

From PC 1 to PC 2:

$ ping 192.168.2.2

After getting replies between systems move to next step.

Step 2: If you have wifi, better!

You will need internet too for installing softwares so yeah.

Step 3: Install Samba

Update packages:

$ sudo apt update 
$ sudo apt upgrade
$  sudo apt install samba

Step 4: Edit the config file

$ sudo nano /etc/samba/smb.conf
[sambashare]
comment = Samba on Ubuntu
path = /home/username/sambashare
read only = no
browsable = yes

Step 5: Restart the server

$ sudo service smbd restart

Step 6: Edit the firewall

$ sudo apt install ufw
$ sudo ufw allow Samba

Step 7: Create user

$ sudo smbpasswd -a username

The samba password we’ve set up is for our user account since samba doesn’t use the system account password. However, the password and username we’ve set must be the same as that of the system.

Step 8: Connect!

Now open up your File Manager > Other Locations > Your Systems’s Name

And give the credentials.

Error:

I’m getting this error!

Solution:

I added these to lines in etc/samba/smb.conf

  force user = your-user-name  
  guest ok = yes 

Still the same error.

Anonymous is not working.

Make sure you have that folder available!!! 😂 Hahaha!

The system which I was trying to access didn’t have sambashare directory. LOL!

Tags :