You are not logged in.

#1 2023-06-03 19:08:31

rabadumpf
Member
Registered: 2018-01-02
Posts: 32

fstab - no write permissions on my network drive

Hello, I have successfully integrated my network drive into the fstab. But I don't have permission to write. All documents are opened read-only. What other option does this include?
Here is my fstab:
//192.168.178.25/data /mnt/data cifs credentials=/home/sxxnnsel/.smbcredentials 0 0
Even a rw doesn't help
//192.168.178.25/data /mnt/data cifs rw,credentials=/home/sxxnnsel/.smbcredentials 0 0

Which option helps to get write rights on my network drive? Thanks in advance

Offline

#2 2023-06-03 19:20:02

seth
Member
Registered: 2012-09-03
Posts: 60,793

Re: fstab - no write permissions on my network drive

mount | grep cifs
stat /mnt/data/path/to/some/file/you/want/to/open.rw

https://man.archlinux.org/man/extra/cif … .cifs.8.en

Offline

#3 2023-06-04 06:32:30

rabadumpf
Member
Registered: 2018-01-02
Posts: 32

Re: fstab - no write permissions on my network drive

[mount | grep cifs
//192.168.178.25/programs on /mnt/programs type cifs (rw,relatime,vers=3.1.1,cache=strict,username=xxxxxxxxx,uid=0,noforceuid,gid=0,noforcegid,addr=192.168.178.25,file_mode=0755,dir_mode=0755,soft,nounix,serverino,mapposix,rsize=4194304,wsize=4194304,bsize=1048576,echo_interval=60,actimeo=1,closetimeo=1)

stat /mnt/data
 Datei: /mnt/data
 Größe: 0         	Blöcke: 0          EA Block: 1048576 Verzeichnis
Gerät: 0/44	Inode: 524289      Verknüpfungen: 2
Zugriff: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Zugriff: 2023-06-03 20:43:07.847163400 +0200
Modifiziert: 2023-05-20 08:22:55.482358800 +0200
Geändert: 2023-05-20 08:22:55.482358800 +0200
Geburt: 2023-05-20 08:22:55.482358800 +0200

mounting with rw fails. uid uid and gid are 0 if not specified and are therefore set correctly, right? What's wrong with the fact that I don't have write permissions?

Offline

#4 2023-06-04 06:52:01

seth
Member
Registered: 2012-09-03
Posts: 60,793

Re: fstab - no write permissions on my network drive

sudo touch /mnt/data/foo
stat /mnt/data/foo

Offline

#5 2023-06-04 18:03:37

rabadumpf
Member
Registered: 2018-01-02
Posts: 32

Re: fstab - no write permissions on my network drive

Datei: /mnt/data/foo
 Größe: 0         	Blöcke: 0          EA Block: 1048576 reguläre leere Datei
Gerät: 0/44	Inode: 12257159884054914200  Verknüpfungen: 1
Zugriff: (0755/-rwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Zugriff: 2023-06-04 19:54:17.768822700 +0200
Modifiziert: 2023-06-04 19:54:17.768822700 +0200
Geändert: 2023-06-04 19:54:17.768822700 +0200
Geburt: 2023-06-04 19:54:17.708793200 +0200

sudo echo "Hallo Welt" >/mnt/data/foo
bash: /mnt/data/foo: Keine Berechtigung

the creation of the file and the associated time stamp are identical to the one above. Creating the file foo works. But even when saving the changed foo file using echo, the write permission is missing.

Offline

#6 2023-06-04 19:46:56

seth
Member
Registered: 2012-09-03
Posts: 60,793

Re: fstab - no write permissions on my network drive

Does the "echo" process write into the file? (rethorical question)

echo "snafu" | sudo tee /mnt/data/foo
sudo mkdir /mnt/data/mystuff
sudo chown ${USER}:${USER} /mnt/data/mystuff
stat /mnt/data/mystuff
echo foo > /mnt/data/mystuff/bar

Offline

#7 2023-06-06 05:00:38

rabadumpf
Member
Registered: 2018-01-02
Posts: 32

Re: fstab - no write permissions on my network drive

echo "snafu" | sudo tee /mnt/data/foo
snafu
sudo mkdir /mnt/data/mystuff
sudo chown ${USER}:${USER} /mnt/data/mystuff
stat /mnt/data/mystuff
Datei: /mnt/data/mystuff
 Größe: 0         	Blöcke: 0          EA Block: 1048576 Verzeichnis
Gerät: 0/45	Inode: 14618005303193286716  Verknüpfungen: 2
Zugriff: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Zugriff: 2023-06-06 06:41:21.600099900 +0200
Modifiziert: 2023-06-06 06:40:40.832053800 +0200
Geändert: 2023-06-06 06:40:40.832053800 +0200
Geburt: 2023-06-06 06:40:40.832053800 +0200
echo foo > /mnt/data/mystuff/bar
bash: /mnt/data/mystuff/bar: Keine Berechtigung

So the text snafu is now in the file foo. Apparently the new folder mystuff was not changed to my user. The owner of the folder is still root. Accordingly, nothing can be moved to the new file bar.

Offline

#8 2023-06-06 06:02:19

-thc
Member
Registered: 2017-03-15
Posts: 775

Re: fstab - no write permissions on my network drive

The "mount.cifs" process has to act as a kind of Janus-headed figure: The CIFS credentials determine which CIFS user will create/modify all files on the server side - the mount options determine the Linux user on the client side. The default mount options are "uid=0,gid=0" - which leads to your situation.

The convenient way would be to add "uid=NNNN,gid=NNNN" (your numerical Linux user/group ID) to the mount options.

Offline

#9 2023-06-06 07:28:10

seth
Member
Registered: 2012-09-03
Posts: 60,793

Re: fstab - no write permissions on my network drive

The inconvenient way would be to properly configure them, https://wiki.archlinux.org/title/Samba# … ermissions

Offline

#10 2023-06-06 18:32:39

rabadumpf
Member
Registered: 2018-01-02
Posts: 32

Re: fstab - no write permissions on my network drive

-thc wrote:

The convenient way would be to add "uid=NNNN,gid=NNNN" (your numerical Linux user/group ID) to the mount options.

Setting uid=1000 and gid=1000 helped and brought write access. Thank you

seth wrote:

The inconvenient way would be to properly configure them, https://wiki.archlinux.org/title/Samba# … ermissions

I would prefer the more cumbersome way via smb.conf. But spontaneously I don't see any major error.
Is it possibly related to the force user and force group? But I want only registered users to be able to write.
Here ist my smb.conf. Thank you!

[global]
security = user
#Aktiveren der smb-Protokolle smb2/3
client min protocol = SMB2
client max protocol = SMB3
workgroup = WORKGROUP
log file = /var/log/samba/log.%m
# This option controls how unsuccessful authentication attempts are mapped
# to anonymous connections
#map to guest = bad user
map to guest = never
vfs objects = streams_xattr

[data]
valid users = xxxxxxuser1
#Wir beschränken den Zugriff auf den User ''xxxxxxuser1''
#Alternativ kann auch auf eine Benutzergruppe eingeschränkt werden
path = /srv/data
public = no
writable = yes
comment = Daten
printable = no
guest ok = no
create mask = 0775
directory mask = 0775
force user = xxxxxxuser1
force group = xxxxxxuser1

Offline

#11 2023-06-06 19:42:38

seth
Member
Registered: 2012-09-03
Posts: 60,793

Re: fstab - no write permissions on my network drive

Is it possibly related to the force user and force group? But I want only registered users to be able to write.

https://man.archlinux.org/man/smb.conf.5 wrote:

force user (S)

This specifies a UNIX user name that will be assigned as the default user for all users connecting to this service. This is useful for sharing files. You should also use it carefully as using it incorrectly can cause security problems.
This user name only gets used once a connection is established. Thus clients still need to connect as a valid user and supply a valid password. Once connected, all file operations will be performed as the "forced user", no matter what username the client connected as. This can be very useful.

You mean
https://wiki.archlinux.org/title/Samba# … ermissions

comment = Public share where archie has write access

?

Offline

#12 2023-06-07 19:11:33

rabadumpf
Member
Registered: 2018-01-02
Posts: 32

Re: fstab - no write permissions on my network drive

The data directory is on my home server. All Linux users at home and Windows users should have access to it and be able to edit the files.
With

security = user

in the global section, I'm already forcing Windows users and Linux users to log in first with a user name and password.
If I think about it, I could then remove the entries

force user = xxxxxxuser1
force group = xxxxxxuser1

in the data-section

Offline

Board footer

Powered by FluxBB