You are not logged in.
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
mount | grep cifs
stat /mnt/data/path/to/some/file/you/want/to/open.rw
Online
[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
sudo touch /mnt/data/foo
stat /mnt/data/foo
Online
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
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
Online
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
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
The inconvenient way would be to properly configure them, https://wiki.archlinux.org/title/Samba# … ermissions
Online
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
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
Is it possibly related to the force user and force group? But I want only registered users to be able to write.
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
?
Online
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