Page 1 of 1

[solved] cifs mount suddenly changed to read only

PostPosted: Nov 30th, '21, 21:32
by magchris
I use a Mageia 8 system to access a smb share. Suddenly the file system which is mounted using cifs is read only instead of read write for my normal user. I can still write files into the mounted file system if I use root.
The mount is defined in fstab. If I try to define a mount by the Mageia control center the server is shown but no further information and it is not possible to define something there.
The smb share is still writable by a Windows client.
I didn't any configuration changes and only applied the normal Mageia updates.
Does anybody have an idea what I can do to gain read write access again.

Re: cifs mount suddenly changed to read only

PostPosted: Nov 30th, '21, 23:21
by doktor5000
And what is the output of e.g. mount command for that share? If you can write to it as root it's probably not mounted with the correct uid/gid.

Re: cifs mount suddenly changed to read only

PostPosted: Dec 1st, '21, 08:54
by magchris
Here the output of the mount command for this share (real names changed)
Code: Select all
//myserver/DataDir on /mnt/DataDir type cifs (rw,relatime,vers=1.0,cache=strict,username=myuser,uid=1000,noforceuid,gid=1000,noforcegid,addr=192.168.7.1,soft,unix,posixpaths,serverino,mapposix,acl,rsize=61440,wsize=65536,bsize=1048576,echo_interval=60,actimeo=1)


The entry in fstab:
Code: Select all
//myserver/DataDir /mnt/DataDir cifs credentials=/etc/samba/auth.myserver.myuser,uid=1000,gid=1000,vers=1.0 0 0


This has worked for years and now I "myuser" has only read access

Re: cifs mount suddenly changed to read only

PostPosted: Dec 1st, '21, 19:34
by doktor5000
vers=1.0 ? That seems pretty ancient ... I'd remove that and try again. You could also check your journal logs for the parts where this share gets mounted, maybe that can provide some details.
You could also unmount it and mount it manually with mount -v /mnt/DataDir and see if that provides some more details on where it goes wrong.

I don't see any halfway recent bug reports about cifs, so this doesn't seem like some common issue.
Also, would be helpful if you could provide a partial ls -al output (anonymized) on the share contents to check the permissions, user and group on the mountpoint and what is inside.

Re: cifs mount suddenly changed to read only

PostPosted: Dec 1st, '21, 21:11
by magchris
If I remove vers=1.0 or change it to a higher version I get following error message:
Code: Select all
mount error: Server abruptly closed the connection.
This can happen if the server does not support the SMB version you are trying to use.
The default SMB version recently changed from SMB1 to SMB2.1 and above. Try mounting with vers=1.0.
mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs) and kernel log messages (dmesg)

If I only use vers=1.0 the file system is mounted but user and group are always root for all files.

Finally I found the solution:
If I add the options
forceuid
and
forcegid
to the entry in fstab then user and group have the expected values.

Here the final entry in fstab which allows writing to the filesystem again
Code: Select all
//myserver/DataDir /mnt/DataDir cifs credentials=/etc/samba/auth.myserver.myuser,uid=1000,gid=1000,forceuid,forcegid,vers=1.0 0 0


@doktor5000 thank you for your hints :)