Configure and access shared folders on Linux
Learn how to configure shared folders and access them on Linux over Meshnet.
In this article, you will learn how to set up a shared folder on Linux and access another device's shared folder from a Linux device.
Note
For this procedure, Ubuntu 24.04 LTS is used as an example.
Prerequisites
Before you begin, download and prepare the Samba app on your Linux device. Samba uses the SMB protocol to share resources over the network. If you want to configure a shared folder using the GUI, you should also install the nautilus-share package.
Install Samba
To install Samba, on your system:
Open Terminal.
Run the following command, which will fetch updates from your repositories and install Samba:
sudo apt update && sudo apt install samba -y
Enable Samba authentication
To secure access to your shared folders, you need to create a Samba password.
Open Terminal.
Run the command below, which will prompt you to create a new Samba password for your current user:
sudo smbpasswd -a $USEREnter and confirm your new password.

Add your current user to the
sambasharegroup with this command:sudo usermod -aG sambashare $USERRestart your PC.
GUI only: Install nautilus-share
The nautilus-share extension adds folder-sharing options to the system's context menu allowing convenient setup.
Open Terminal.
Install
nautilus-shareby running the command below:sudo apt install nautilus-share -yTo activate the extension you need to restart the Nautilus processes. Use this command to quit Nautilus:
nautilus -qNext time you open the Files app, Nautilus will start automatically.
Configure a shared folder
Depending on your system, you may opt to configure a shared folder using the operating system's file manager or by using the command line.
To create a network share using a file manager's network-sharing options:
Right-click the folder you want to share and choose Sharing options.


Select Share this folder, and, if needed, enter a custom name for your network share.
Click Create share.


Take the following steps to share a folder via the command line:
Open Terminal.
Navigate to the folder that you want to share and print out its absolute path by using the
pwdcommand.Example

Run the following command to open the Samba configuration file using the Nano text editor:
At the end of the file, append the following lines where
<ShareName>is the name for your network share and</path/to/folder>is the absolute path of the folder from step 2:Example

Press Ctrl + X, Y, and Enter to save changes and exit.
Run the following command to restart the Samba process:
Note
To access the shared folder, the peer device will need to use your Linux username and the previously created Samba password for authentication.
Access shared folders
Note
You can find platform-specific instructions for accessing the shared folder in the appropriate guides:
Most Linux file managers let you directly access files shared on other devices. In this example, you will learn how to access a network share using GNOME Files.
Run the
nordvpn meshnet peer listcommand and copy the Nord name of the sharer's device.
Open GNOME Files and select Other locations in the sidebar.


In the Enter server address field at the bottom, type in
smb://, paste the copied Nord name, add a slash (/) followed by the network share name, and click Connect. Examplesmb://secret.meerkat-himalayas.nord/MeshnetFolder

Select Registered user and enter the username and password for accessing the shared folder.


Click Connect.
The shared folder should now open in the file manager.
Mount a shared folder
The shared folder you connect to becomes unavailable after a system restart, which means that you would need to reconnect to the folder each time you wish to access the files stored in it. However, by utilizing CIFS, you can mount the shared folder directly on your system and use it as a persistent storage location.
Prepare a mounting point
Open Terminal.
Fetch repository updates and install CIFS by entering the following:
Create a new directory using the
mkdircommand, where you want to mount the shared folder. ExampleNavigate to the newly created folder using the
cdcommand and print out its full path using thepwdcommand.
Check your user ID number by executing this command:
Edit the file system table
Open the
fstabfile with root privileges using the Nano text editor by running this command:At the end of the file, append the following line for the shared folder:
Where:
<NordName>is the Nord name or the Meshnet IP of the host device.<ShareName>is the name of the network share you are trying to access</path/to/folder>is the path to the mounting point from Step 4 of the Prepare a mounting point section.<USERNAME>and<PASSWORD>are the authentication details for accessing the shared folder.
Press Ctrl + X, Y, and Enter to save changes and exit.
Run the following command to mount the network share:
Apply the changes to your file system table by reloading SystemD with the following command:
You can now access the shared folder from the sidebar in the Files app.


See also
Last updated
Was this helpful?