|(12 intermediate revisions by 9 users not shown)|
The following tutorial will guide you through setting up usersharing with Samba so that you can use your file manager to share folders (nautilus-share, nemo-share, Thunar Shares Plugin, etc.). Ubuntu style.
First we need to install a few packages. Open a terminal and become root:
need to install :
Install samba, nautilus- share and gvfs- smb. If you use a different file manager, please install the corresponding sharing package for your file manager instead of nautilus- share. In the terminal, enter:
pacman - S samba nautilus-share gvfs-smb
Now we are ready to set up Manjaro for usershares. Usershares allows a non-root user to add, modify, and delete their own samba shares.
First we're going to create the usershare path. This is were samba stores the share configuration (so it's not going in < code>/etc/samba/smb.conf</code> )
In the terminal, enter:
mkdir -p /var/lib/samba/usershare
We have now added the usershares directory in <code>/var/lib/samba</code>.
Next we need to create the sambashare group. In the terminal, enter:
We need to make user < code> root</code> owner of both the usershares directory and the sambashare group.
In the terminal, enter:
chown root:sambashare /var/lib/samba/usershare
Because <code>/ var/lib/samba/usershare< /code> is now owned by <code>root</code>, we need to make the usershare directory accessible for non- root users.
In the terminal, enter:
chmod 1770 /var/lib/samba /usershare
This chmod command sets the sticky bit (makes the permissions fixed for non-root users), as signified by the preceding 1 in the 1770 string. The 7+7 signifies that users and groups can read, write and execute. The 0 means that "others" have no rights to the directory.
Now we need to create a new < code>smb.conf</code> from the template configuration file. In the terminal, enter:
cp /etc/samba /smb.conf.default /etc/samba/smb.conf
Open the newly created <code>smb.conf</code> in a text editor. In the terminal, enter:
Replace < code> nano</code>with the name of your preferred text editor.
To make usershares possible we need to add the following parameters under section < code>[global]</code> :
usershare path = /var/lib/samba/usershare
usershare max shares = 100
usershare allow guests = yes
usershare owner only = yes
Approximately halfway in the <code>[global]</ code> section is the parameter <code>security = user< /code> . Find this line and add the following immediately after:
map to guest = bad user
This line makes it possible for users without a "proper username" to still connect to a share.
Save the < code> smb.conf</code> file with CTRL+O and close nano with CTRL+X.
Now add your user to the sambashare group. Replace <code><username></code> with your real username. In the terminal, enter:
your to the group .
usermod -a -G sambashare <username>
We still need to enable the samba service. In the terminal, enter:
systemctl enable smbd nmbd
systemctl start smbd nmbd
Log out and log back in. It should now be possible to configure samba shares using the GUI. For instance, in Gnome Files you can right click on any directory and share it on the network.
to the and on .
To be able to share directories in your home (< code>/home/<username></code> ) you also need to add new permissions to your home (<code>/home/<username></code>). Replace <code><username></code> with your own username. In the terminal, enter:
chmod 701 /home/< username>
The 701 gives read, write and execute permissions to the user, zero rights to groups and execute rights to "other". The execute rights for "other" seems to be required for samba to be able to access the lower directories under < code> /home/<username></code>. Other users can't enter your home directory with only the execute bit set, but it might lessen security, as others now do have permission to execute stuff under your home. There needs to be executable stuff in there beforehand, though, and others need to know the path to the executable by heart, before they can run it. It doesn't seem to have much room for misschief, but caveat emptor.
A forum thread discussing this subject is available here: [https:// forum. manjaro.org/index.php ?topic=16833.0]
Dolphin is capable of mounting smb file shares without needing any additional packages. All other file managers require installing the package
gvfs-smb. This is present by default in most Manjaro editions but if you need to install it you can so with:
pamac install gvfs-smb
Sharing Files from the File Manager
The following will guide you through setting up user sharing with Samba so that you can use your file manager to share folders.
Depending on which file manager you use there are different packages to install. Please reference the appropriate section for your file manager.
manjaro-settings-samba package will install a basic config and enable the file sharing services. The whole process is nicely automated.
Nemo - Cinnamon
pamac install nemo-share manjaro-settings-samba
Nautilus - Gnome/Budgie
pamac install nautilus-share manjaro-settings-samba
Caja - MATE
pamac install caja-share manjaro-settings-samba
Thunar - XFCE
pamac install thunar-shares-plugin-gtk3
Dolphin - KDE/plasma
pamac install samba kdenetwork-filesharing manjaro-settings-samba
Once you have installed the required packages for your file manager you should reboot to start the services and let the group changes take effect.
Since samba 4.11.0 released on 2019-09-17, the very old Windows NT protocol is disabled by default because of serious security issues, so if you connect to:
- a supported Windows version
- a supported Linux Samba server
- a supported NAS appliance
Please upgrade these to the latest version and disable the NT1 protocol on these servers if not done automatically.
If you connect to:
- an unsupported Windows version
- an unsupported NAS
Please turn off file sharing towards the Internet and know that malicious users on your LAN (unless isolated in a guest network) will be able to access all local NT1 shares with full control.
If you are getting permission denied when connecting to a new share, one common cause of this is that samba does not have access to Linux user passwords by default. To remedy this, create a samba password for your user account:
sudo smbpasswd -a theusername
This will create a password for the user.
If you get an error that you don't have rights to create shares ensure that you user account has been added to the group sambashare. After modifying groups it is required to logout for the changes to take effect.
If you are getting "connection denied" errors make sure you have allowed access through your firewall. See the firewall wiki article for more details.