• Willkommen im Linux Club - dem deutschsprachigen Supportforum für GNU/Linux. Registriere dich kostenlos, um alle Inhalte zu sehen und Fragen zu stellen.

[gelöst]NFS bestimmte Rechte bei Dateierstellung setzen

norritt

Member
Hallo zusammen,

ich habe hier einen digitalen Satellitenreceiver auf dem ein embedded Linux läuft (Kernel 2.6.9). Das Gerät erlaubt es aufnahmen direkt via NFS auf einen Server zu streamen. Auf meinem Server läuft OpenSUSE 12.1. Grundsätzlich funktioniert die Sache, leider aber mit einer Einschränkung. Alle Aufnahmen werden mit den falschen Userrechten angelegt, sodass ich mich immer einloggen und die Rechte manuell neu setzen muss, um die Dateien über Samba (windows) abrufen zu können. Ich habe bereits versucht die Rechte mit setfacl zu korrigieren, leider greift dieser Mechanismus scheinbar nicht bei Dateien die via NFS angelegt werden. Auch das ändern der umask für die entsprechenden User (Eintrag in .profile) auf beiden Systemen brachte keine Änderung.

Hat jemand eine Idee wie ich die Standardrechte für neuangelegte Dateien für ein NFS Share festlegen kann?
 

spoensche

Moderator
Teammitglied
Du musst eher deine Samba Konfiguration für die Freigabe anpassen. Welcher User ist den der Eigentümer der Datei und welche Gruppe ist gesetzt? Ist der User auf der Windose der gleiche oder heisst er anders?

Wie sieht die Konfiguration des Samba Shares aus?
 
OP
N

norritt

Member
Hmm okay, wobei wundersamerweise die Dateien über Samba abrufbar sind, sobald ich erstmal die ext4 Rechte gesetzt habe.

So aber wie gewünscht hier mal die Samba config. NFS UID und GID sind so gemapped dass die Dateien, dem user "video" und der gruppe "resident" gehören.

Code:
[global]
        workgroup = HOMENET
        netbios name = CUBE.HOMENET.LOCAL
        netbios aliases = cube
        server string = CUBE
        map to guest = Bad User
        printcap name = cups
        logon path = \\%L\profiles\.msprofile
        logon drive = P:
        logon home = \\%L\%U\.9xprofile
        usershare allow guests = Yes
        idmap config * : backend = tdb
        create mask = 0700
        directory mask = 0700
        cups options = raw
        map hidden = Yes
        map system = Yes

...

[TV-Recordings]
        acl check permissions = No
        inherit owner = Yes
        inherit permissions = Yes
        writeable = yes
        path = /home/video/recordings/movie
        write list = @resident
        force directory mode = 0775
        force create mode = 0764
        create mask = 0764
        directory mask = 0775
        inherit acls = Yes

Aber wo wir gerade beim Thema Samba sind. Ich habe noch ein anderes Problem mit Samba und Win 7. Beim Anlegen von neuen Dateien auf dem "Privatshare" meines Users erhalten die Dateien automatisch rwx Rechte für den Benutzer, "Gruppe" und "Andere" haben keine Rechte. Ich kann problemlos Dateien anlegen und löschen. Leider lässt Windows das Ändern nicht zu, und zwar weil bei Win das "Ändern" recht separat verwaltet wird. Das wiederum hat zur Folge, dass ich, jedes mal wenn ich eine neue Datei angelegt habe und diese ändern möchte, über den Explorer das "Ändern-Recht" nachträglich setzen muss.

no_change.png


Code:
        path = /home/norritt/storage/personal
        valid users = norritt
        write list = norritt
        read only = No
        acl check permissions = No
        force create mode = 0700
        force directory mode = 0700
        inherit permissions = Yes
        inherit acls = Yes
        inherit owner = Yes

P.S.: Sollte das erste Problem tatsächlich an Samba liegen, macht es evtl. Sinn den Post ins Samba Forum zu verschieben.

P.P.S.: Ich have evtl. Abhilfe für das bei NFS nicht funktionierende setfacl gefunden. Es gibt offenbar ein Kernelmodul names "nfs_acl" welches bei opensuse nicht standardmäßig nicht geladen ist.
 

spoensche

Moderator
Teammitglied
NFS ACL kannst du nur mit NFSv4 verwenden. Wie sehen die Rechte auf der Freigabe aus?
Code:
ls -l /home/norritt/storage/personal
? Was sagen die Logs vom Samba? Was sagt
Code:
testparm
 
OP
N

norritt

Member
spoensche schrieb:
Wie sehen die Rechte auf der Freigabe aus?
Code:
cube:/home/norritt/storage # ls -l
total 4
drwx--S---+ 33 norritt resident 4096 Jan 27 23:47 personal
cube:/home/norritt/storage # getfacl personal/
# file: personal/
# owner: norritt
# group: resident
# flags: -s-
user::rwx
group::---
other::---
default:user::rwx
default:user:norritt:rwx
default:group::---
default:mask::rwx
default:other::---

Das hier ist die TV-Aufnahmefreigabe:
Code:
 # ls -l /home/video/recordings/
total 984
-rwxrw-r-- 1 video resident 940334 Sep 11 23:12 epg.dat
-rwxrw-r-- 1 video resident     16 Sep 11 23:12 epg.dat.md5
drwxrwsr-- 2 video resident   4096 Sep 11 03:36 log
drwxrwsr-x 2 video resident  49152 Jan 28 02:24 movie
-rwxrw-r-- 1 video resident     19 Sep 11 23:12 private_epg.dat
-rwxrw-r-- 1 video resident     16 Sep 11 23:12 private_epg.dat.md5

# getfacl /home/video/recordings/movie/
getfacl: Removing leading '/' from absolute path names
# file: home/video/recordings/movie/
# owner: video
# group: resident
# flags: -s-
user::rwx
group::rwx
other::r-x

Zusatzinfo wegen ACLs die Homepartition ist folgendermaßen gemounted:
Code:
# cat /etc/fstab | grep home
/dev/vg_data0/lv_data0                                          /home                ext4       acl,user_xattr,noatime                  1 2

spoensche schrieb:
Was sagen die Logs vom Samba?
Samba nörgelt nur wegen cups rum
Code:
 # cat /var/log/messages | grep smbd | tail -n 40
Jan 28 17:33:41 cube smbd[2177]: [2013/01/28 17:33:41.013270,  0] printing/print_cups.c:151(cups_connect)
Jan 28 17:33:41 cube smbd[2177]:   Unable to connect to CUPS server localhost:631 - Verbindungsaufbau abgelehnt
Jan 28 17:33:41 cube smbd[20187]: [2013/01/28 17:33:41.014139,  0] printing/print_cups.c:528(cups_async_callback)
Jan 28 17:33:41 cube smbd[20187]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jan 28 17:46:41 cube smbd[2236]: [2013/01/28 17:46:41.757433,  0] printing/print_cups.c:151(cups_connect)
Jan 28 17:46:41 cube smbd[2236]:   Unable to connect to CUPS server localhost:631 - Verbindungsaufbau abgelehnt
Jan 28 17:46:41 cube smbd[20187]: [2013/01/28 17:46:41.758295,  0] printing/print_cups.c:528(cups_async_callback)
Jan 28 17:46:41 cube smbd[20187]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jan 28 17:59:42 cube smbd[2313]: [2013/01/28 17:59:42.487978,  0] printing/print_cups.c:151(cups_connect)
Jan 28 17:59:42 cube smbd[2313]:   Unable to connect to CUPS server localhost:631 - Verbindungsaufbau abgelehnt
Jan 28 17:59:42 cube smbd[20187]: [2013/01/28 17:59:42.488819,  0] printing/print_cups.c:528(cups_async_callback)
Jan 28 17:59:42 cube smbd[20187]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jan 28 18:12:43 cube smbd[2350]: [2013/01/28 18:12:43.167534,  0] printing/print_cups.c:151(cups_connect)
Jan 28 18:12:43 cube smbd[2350]:   Unable to connect to CUPS server localhost:631 - Verbindungsaufbau abgelehnt
Jan 28 18:12:43 cube smbd[20187]: [2013/01/28 18:12:43.167991,  0] printing/print_cups.c:528(cups_async_callback)
Jan 28 18:12:43 cube smbd[20187]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jan 28 18:25:43 cube smbd[2392]: [2013/01/28 18:25:43.844726,  0] printing/print_cups.c:151(cups_connect)
Jan 28 18:25:43 cube smbd[2392]:   Unable to connect to CUPS server localhost:631 - Verbindungsaufbau abgelehnt
Jan 28 18:25:43 cube smbd[20187]: [2013/01/28 18:25:43.845010,  0] printing/print_cups.c:528(cups_async_callback)
Jan 28 18:25:43 cube smbd[20187]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jan 28 18:38:44 cube smbd[2424]: [2013/01/28 18:38:44.577034,  0] printing/print_cups.c:151(cups_connect)
Jan 28 18:38:44 cube smbd[2424]:   Unable to connect to CUPS server localhost:631 - Verbindungsaufbau abgelehnt
Jan 28 18:38:44 cube smbd[20187]: [2013/01/28 18:38:44.577318,  0] printing/print_cups.c:528(cups_async_callback)
Jan 28 18:38:44 cube smbd[20187]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jan 28 18:51:45 cube smbd[2519]: [2013/01/28 18:51:45.262314,  0] printing/print_cups.c:151(cups_connect)
Jan 28 18:51:45 cube smbd[2519]:   Unable to connect to CUPS server localhost:631 - Verbindungsaufbau abgelehnt
Jan 28 18:51:45 cube smbd[20187]: [2013/01/28 18:51:45.262598,  0] printing/print_cups.c:528(cups_async_callback)
Jan 28 18:51:45 cube smbd[20187]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jan 28 19:04:45 cube smbd[2549]: [2013/01/28 19:04:45.999568,  0] printing/print_cups.c:151(cups_connect)
Jan 28 19:04:46 cube smbd[2549]:   Unable to connect to CUPS server localhost:631 - Verbindungsaufbau abgelehnt
Jan 28 19:04:46 cube smbd[20187]: [2013/01/28 19:04:46.000017,  0] printing/print_cups.c:528(cups_async_callback)
Jan 28 19:04:46 cube smbd[20187]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jan 28 19:15:20 cube smbd[10210]: [2013/01/28 19:15:20.951993,  0] printing/print_cups.c:151(cups_connect)
Jan 28 19:15:20 cube smbd[10210]:   Unable to connect to CUPS server localhost:631 - Verbindungsaufbau abgelehnt
Jan 28 19:15:20 cube smbd[10203]: [2013/01/28 19:15:20.957663,  0] printing/print_cups.c:528(cups_async_callback)
Jan 28 19:15:20 cube smbd[10203]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jan 28 19:16:21 cube smbd[11453]: [2013/01/28 19:16:21.017987,  0] printing/print_cups.c:151(cups_connect)
Jan 28 19:16:21 cube smbd[11453]:   Unable to connect to CUPS server localhost:631 - Verbindungsaufbau abgelehnt
Jan 28 19:16:21 cube smbd[10203]: [2013/01/28 19:16:21.018430,  0] printing/print_cups.c:528(cups_async_callback)
Jan 28 19:16:21 cube smbd[10203]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL

spoensche schrieb:
Was sagt tesparm?

Code:
# testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
NOTE: Service homes is flagged unavailable.
Processing section "[profiles]"
NOTE: Service profiles is flagged unavailable.
Processing section "[users]"
NOTE: Service users is flagged unavailable.
Processing section "[groups]"
NOTE: Service groups is flagged unavailable.
Processing section "[printers]"
NOTE: Service printers is flagged unavailable.
Processing section "[print$]"
Processing section "[norritts_personal_files]"
Processing section "[Software]"
Processing section "[norritt_backup]"
Processing section "[media]"
Processing section "[TV-Recordings]"
Processing section "[xfer]"
Processing section "[luna_backup]"
Loaded services file OK.
WARNING: You have some share names that are longer than 12 characters.
These may not be accessible to some older clients.
(Eg. Windows9x, WindowsMe, and smbclient prior to Samba 3.0.)
Invalid combination of parameters for service print$.                      Map hidden can only work if create mask includes octal 01 (S_IXOTH).
Invalid combination of parameters for service print$.                      Map system can only work if create mask includes octal 010 (S_IXGRP).
Invalid combination of parameters for service norritts_personal_files.                     Map hidden can only work if create mask includes octal 01 (S_IXOTH).
Invalid combination of parameters for service norritts_personal_files.                     Map system can only work if create mask includes octal 010 (S_IXGRP)                                                     .
Invalid combination of parameters for service Software.                            Map hidden can only work if create mask includes octal 01 (S_IXOTH).
Invalid combination of parameters for service Software.                            Map system can only work if create mask includes octal 010 (S_IXGRP).
Invalid combination of parameters for service norritt_backup.                      Map hidden can only work if create mask includes octal 01 (S_IXOTH).
Invalid combination of parameters for service norritt_backup.                      Map system can only work if create mask includes octal 010 (S_IXGRP).
Invalid combination of parameters for service media.                       Map hidden can only work if create mask includes octal 01 (S_IXOTH).
Invalid combination of parameters for service TV-Recordings.                       Map hidden can only work if create mask includes octal 01 (S_IXOTH).
Invalid combination of parameters for service TV-Recordings.                       Map system can only work if create mask includes octal 010 (S_IXGRP).
Invalid combination of parameters for service xfer.                        Map hidden can only work if create mask includes octal 01 (S_IXOTH).
Invalid combination of parameters for service xfer.                        Map system can only work if create mask includes octal 010 (S_IXGRP).
Invalid combination of parameters for service luna_backup.                         Map hidden can only work if create mask includes octal 01 (S_IXOTH).
Invalid combination of parameters for service luna_backup.                         Map system can only work if force create mode excludes octal 010 (S_IXGRP).
Server role: ROLE_STANDALONE
 

spoensche

Moderator
Teammitglied
Zum einen sind die Rechte für die Recordings so gesetzt, dass nur der Eigentümer und die Gruppe Schreibrechte haben. Folglich muss der Windows Nutzer entweder der Eigentümer oder aber Mitglied der Gruppe sein.

Die Ausgabe von testparm teilt dir die Konfiguratonsfehler ja schon mit und die solltest du auch beheben.
 
OP
N

norritt

Member
Hi Spoensche,

danke für den Stubser in die richtige Richtung, testparm kannte ich noch nicht und mir war auch die Wechselwirkung zwischen den map_system, map_hidden, map_archive optionen und den Linux-Executable-Bits nicht klar. Aber tatsächlich war das die Ursache für die seltsamen Probleme. Sollte jemand einen ähnlichen Fehler beobachten, z.B. verschwindende Dateien bei vollen Rechten, prüft ob vielleicht die "x" bits und die map_hidden option aktiv sind. Eine gute Erklärung des Mappingsystems habe ich hier gefunden.
 
Oben