Manjaro Difference between revisions of "Using Samba in your File Manager"

Difference between revisions of "Using Samba in your File Manager"

From Manjaro
imported>Excalibur1234
(Marked this version for translation)
 
(10 intermediate revisions by 8 users not shown)
Line 1: Line 1:
<languages/>
__TOC__


<translate>
=Accessing SMB Shares from the File Manager= <!--T:1-->


'''XFCE users''' using Thunar file manager should [https://forum.manjaro.org/index.php?topic=11810.msg146682#msg146682 read this forum thread.]
<!--T:2-->
Dolphin is capable of mounting smb file shares without needing any additional packages. All other file managers require installing the package {{ic|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= <!--T:3-->


<!--T:4-->
The following will guide you through setting up user sharing with Samba so that you can use your file manager to share folders.




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.
== Installation == <!--T:5-->


<!--T:6-->
Depending on which file manager you use there are different packages to install.  Please reference the appropriate section for your file manager.


First we need to install a few packages. Open a terminal and become root:


  su
<!--T:7-->
The {{ic|manjaro-settings-samba}} package will install a basic config and enable the file sharing services. The whole process is nicely automated.


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
===Nemo - Cinnamon=== <!--T:8-->


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.
<!--T:9-->
pamac install nemo-share manjaro-settings-samba


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
===Nautilus - Gnome/Budgie=== <!--T:10-->


We have now added the usershares directory in <code>/var/lib/samba</code>.
<!--T:11-->
pamac install nautilus-share manjaro-settings-samba


Next we need to create the sambashare group. In the terminal, enter:


groupadd sambashare
===Caja - MATE=== <!--T:12-->


We need to make user <code>root</code> owner of both the usershares directory and the sambashare group.
<!--T:13-->
pamac install caja-share manjaro-settings-samba


In the terminal, enter:


chown root:sambashare /var/lib/samba/usershare
===Thunar - XFCE=== <!--T:14-->


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.
<!--T:15-->
In the terminal, enter:
pamac install thunar-shares-plugin-gtk3


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.
===Dolphin - KDE/plasma=== <!--T:16-->


Now we need to create a new <code>smb.conf</code> from the template configuration file. In the terminal, enter:
<!--T:17-->
pamac install samba kdenetwork-filesharing manjaro-settings-samba


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:
==Finishing Up== <!--T:18-->


nano /etc/samba/smb.conf
<!--T:19-->
Replace <code>nano</code>with the name of your preferred text editor.  
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.


To make usershares possible we need to add the following parameters under section <code>[global]</code>:


  usershare path = /var/lib/samba/usershare
=Troubleshooting= <!--T:20-->
  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:
==Protocol version== <!--T:21-->


map to guest = bad user
<!--T:22-->
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


This line makes it possible for users without a "proper username" to still connect to a share.
<!--T:23-->
Please upgrade these to the latest version and disable the NT1 protocol on these servers if not done automatically.


Save the <code>smb.conf</code> file with CTRL+O and close nano with CTRL+X.
<!--T:24-->
If you connect to:
* an unsupported Windows version
* an unsupported NAS


Now add your user to the sambashare group. Replace <code><username></code> with your real username. In the terminal, enter:
<!--T:25-->
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.


usermod -a -G sambashare <username>
==User Accounts== <!--T:26-->


We still need to enable the samba service. In the terminal, enter:
<!--T:27-->
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


systemctl enable smbd nmbd


systemctl start smbd nmbd
<!--T:28-->
This will create a password for the user.


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 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:
==User Doesn't have Rights to Create Shares== <!--T:29-->


chmod 701 /home/<username>
<!--T:30-->
If you get an error that you don't have rights to create shares ensure that you user account has been added to the [[System_Maintenance#Groups|group]] sambashare.  After modifying groups it is required to logout for the changes to take effect.


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]
==Firewall== <!--T:31-->




[[Category:Contents Page]]
<!--T:32-->
If you are getting "connection denied" errors make sure you have allowed access through your firewall.  See [[Firewalls|the firewall wiki article]] for more details.
 
=See Also= <!--T:33-->
* The [https://www.samba.org/ Samba Project]
* The [https://wiki.archlinux.org/index.php/Samba Arch Wiki] Samba Page
</translate>
 
[[Category:Contents Page{{#translation:}}]]

Latest revision as of 18:58, 7 September 2021

Other languages:
English • ‎Türkçe • ‎русский

Accessing SMB Shares from the File Manager

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.


Installation

Depending on which file manager you use there are different packages to install. Please reference the appropriate section for your file manager.


The 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


Finishing Up

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.


Troubleshooting

Protocol version

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.

User Accounts

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.


User Doesn't have Rights to Create Shares

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.


Firewall

If you are getting "connection denied" errors make sure you have allowed access through your firewall. See the firewall wiki article for more details.

See Also

Cookies help us deliver our services. By using our services, you agree to our use of cookies.