📜 ⬆️ ⬇️

Problems mounting CIFS clients when upgrading samba on the server

The home file server (GNU / Linux) worked on the third Samba. Access to the files was made completely public anonymous, since outsiders are not in principle and do not protect themselves from anyone.
It's time to change the server to a more powerful one (new tasks have appeared). When setting up, there was a problem with connecting different clients to the new version of Samba.


Server samba


Both the old and new servers use GNU / Linux distributions with binary packages - this makes it easy to install and regularly update the software.

Since there is no need to restrict access to the file server, the guest login is used and the samba user base is empty.
')
The key parameters of smb.conf on the old server (smbd version 3.2.5):
[global] security = share dos charset = CP866 guest account = smbguest invalid users = root [files] path = /srv/files comment = Files browseable = yes writable = yes public = yes guest only = yes 


On the new server, Samba is already the fourth version, and it has quite a lot of changes. The most important for the described configuration:


I copied /etc/samba/smb.conf to a new server, commented out security = share (security = user is used by default) and started nmbd and smbd.

Linux clients


Connecting to the “files” resource of the old server in / etc / fstab:
 //srv/files /srv/files cifs rw,guest,ip=192.0.2.2,uid=1001,gid=users 

When you try to connect the resource files of the new server with the same options, we get the error:
 # mount -t cifs -o rw,ip=192.0.2.17,uid=1001,gid=users,guest //host-17/files /srv/host17files mount: block device //host-17/files is write-protected, mounting read-only mount: cannot mount block device //host-17/files read-only 


Attempts to find the right parameters failed, I had to google.
It turned out that the cifs support compiled in / sbin / mount does not support new versions of samba, and you need to use /sbin/mount.cifs (not installed by default). For installed Ubuntu and Altlinux distributions, this file is contained in the cifs-utils package (program versions 6.0 and 5.7, respectively). After installing the package, the mount began to run without errors.

Windows clients


When connecting to the old server worked anonymous login.
When trying to connect to a new server, we get a login-password request.

The reason for this behavior is that Windows first tries to log in to the server with Windows user credentials, and only fails to use the guest input, while in the samba in security = user mode, the default is done so that when you try to log in with an unknown user it does not switch to the guest entrance (the parameter “map to guest = Never” is responsible for this, this is the default value).

The solution is simple: you need to specify "map to guest = Bad User" in the global section smb.conf.

In a configuration other than that described, such a parameter value can cause a connection failure - if a password is used and the login matches the samba user base. For such a case, there are other options for the parameter, or you can use the advice so that the usernames do not match.

Source: https://habr.com/ru/post/260237/


All Articles