Most households have multiple computers, whether it’s a combination of desktops, laptops, or a mix of both, plus wireless gadgets such as tablets and smart phones. One of the most fundamental and useful tasks is being able to share folders, files, and printers across a home network. Let’s take a look at one of the easiest ways to share/access files from multiple devices running Linux Mint. As a note, this should work with Ubuntu as well, but I find Linux Mint a bit easier to use and is the reference for this article.
There are a few different ways to set up a home Linux network, but the following method is how I setup my desktop and laptops all running Linux Mint.
1. Gather/Setup the Internal IP addresses on all the computers that you will be networking.
On the system tray, right click on the Network Manager icon and select “Connection Information”. Depending on your connection type, the network manager icon might display an icon with a pair of linked computer (for cable connection) or an icon with the wireless status (for wireless connection). This window will show you all of the network information you will need for the device, including its IP address.
Setup a static IP or reserve addresses
Since most PC’s and routers use DHCP by default to get internal IP addresses automatically, there is a chance that the IP address for a device may change if it is rebooted or if the lease is renewed. This can cause the network share to disconnect. There are two ways to resolve this:
- In your router settings, you can set a reserved IP address for a specific physical address (MAC address)
- You can create a static IP for the network interface.
I use static IP’s for my devices and will show that procedure in this article. If you want to reserve IP addresses in the router, you will need to check your particular router’s settings. Each router is different but should have a setting to reserve a specific IP address for a specific MAC address.
To set up a static IP in Linux Mint, right-click on the network manager icon in the system tray and select “Edit Connections”. Choose the “Wired” tab if the PC is connected via network cable or “Wireless” if connected by wireless. Highlight the correct interface or wireless network and click “Edit”.
In the “Edit” window, select the IPv4 tab. Click the drop-down and select “manual”. Then edit the IP address, NetMask, and Gateway information. You need to make sure the IP address for each device is unique. I normally just use the current IP that was given via DHCP and make sure it becomes the static IP. You can use any numbering scheme you like as long as they are unique. After all the information is entered, click Apply and from that moment forward that device will always have the IP address that you manually typed in.
2. Install the SSH Server on each device.
SSH is secure and easy to use. The SSH client software is installed by default, but the server is not. If you want to be able to connect to a specific device, that device must have SSH Server installed. If you never want to connect to a specific device you can skip this step. You’ll be able to connect from that device to another device in that case (client to server).
To install OpenSSH Server, open your terminal and type:
sudo apt-get install openssh-server
Type in your sudo password and the SSH server will install. That’s all there is to it!
3. Configure the Firewall settings on each Device
You will need to set the Firewall settings on each device to allow traffic to come in from the other devices. Go to the “Menu -> All Applications -> Firewall Configuration” or at a command line, type:
This will bring up the GUI frontend to the ufw firewall. Click “Add” and click the Advanced tab. In the “From” box, type in the IP address of the device that will be connecting to this device, and in the “To” box, type in the address of this device (the device whose firewall settings you are now configuring). Click “Add” and you will see the rule in the main window. In this example, IP 192.168.1.104/tcp is the computer that I am setting the firewall configuration on and the rule is allowing traffic from the device at 192.168.1.109.
Add rules for any other devices that will need to connect/share with this device to ensure the firewall will accept traffic and file sharing.
4. Connect to Each Device/Desktop/Laptop.
After SSH is installed and all firewall settings are correctly configured, it’s the moment of truth; now we will create connections via SSH to the device that we want to share with.
Let’s say that the device on 192.168.1.109 is a laptop and we’re connecting it to 192.168.1.104 which is a desktop.
- On the laptop, open the Nautilus file manager.
- Click on “File -> Connect to Server”.
- In the “service type” drop-down, select SSH.
- Type in the IP Address of the device you wish to connect to, in this example: 192.168.1.104. Then click Connect. If it finds to device correctly, you will see a login window. Type in your username and password for the device you are connecting to and select “Remember forever”.
5. Linux Mint will then mount a folder directory to the computer at the IP address you named and a File Directory window will open allowing you to browse the networked computer’s folders and files.
5. Create a Folder Shortcut.
Once you have access to the remote/networked computer, you can create a shortcut folder in the left sidebar of the File Manager window. Simply drag a folder into the left sidebar (I normally drag the “Home” folder from the remote computer). You can then rename the folder to something meaningful, such as “Desktop_Home”. Now anytime you click on this folder, it will connect to the networked computer and you can access its directory. Since you saved the password, you will not need to login again, unless the password is changed in the future.
6. Rinse and Repeat
Now you can simply repeat the process on the other devices and create the shortcut folder on each one. Whenever you want to share across device, you can connect via the shared folder shortcut (providing the other device is on, of course!).
Though it involves a few steps, I found this is one of the easier ways to access folders and files amongst my desktops and laptops at home that are all running Linux Mint. What other ways do you use to create a home network?
Image credit: By Lars P.
Receive the latest update in your inbox.