Samba Freigabe für unberechtigte User verstecken

Hallo
ich habe folgendes Problem . Ich will das in der Browselist von Windows oder Mac nur die Freigaben eines Benutzers angezeigt werden auf die er auch Zugriff hat.
Umsetzung sollte so erfolgen :
[share]

browseable = no

include = /etc/samba/%U.conf

Wo %U der Benutzername des Angemeldeten Benutzers ist . Sagen wir der Benutzer ist peatsn. In diesem Fall erzeugen wir eine Datei mit dem Namen /etc/samba/peatsn.conf deren Inhalt

browseable = yes

ist.

Auf diesem Weg ist für alle für die keine Include-Datei bereitsteht der Parameter browseable=no und somit der ordner nicht Sichtbar.

Diese Methode Funktioniert unter Samba version 4.2.10-Debian .
Sie funktioniert allerdings nicht auf einem Univention DC Master 4.1-3 mit Samba version 4.3.7-Debian . Dort startet nicht mal der smbd, weil er scheinbar mit der %U Variable nichts anfangen kann.

Kann mir jemand sagen wie man das beheben kann oder gibt es eine andere Möglichkeit Shares zuverlässig auszublenden. access based share enum habe ich auch getestet interressiert MAC OS aber nicht.

Vielen Dank im Vorraus .

Hier würde man folgendes finden:

man smb.conf

[quote] hide unreadable (S)

       This parameter prevents clients from seeing the existance of files that cannot be read. Defaults to off.

       Please note that enabling this can slow down listing large directories significantly. Samba has to evaluate the ACLs of all directory members, which can be a lot of effort.

       Default: hide unreadable = no

   hide unwriteable files (S)

       This parameter prevents clients from seeing the existance of files that cannot be written to. Defaults to off. Note that unwriteable directories are shown as usual.

       Please note that enabling this can slow down listing large directories significantly. Samba has to evaluate the ACLs of all directory members, which can be a lot of effort.

       Default: hide unwriteable files = no[/quote]

Ist das bereits hilfreich?

Gruß,
Jens Thorp-Hansen

Soweit ich weiß blendet dieser Parameter nur Dateien und Verzeichnisse innerhalb eines freigegebenen Verzeichnisses aus . Das ist nicht was ich will.

Danke Trotzdem

Hallo peatsn,

nachdem der smbd nicht mal startet, ist vielleicht schon an der Konfiguration was falsch. Ich würde mal %u statt %U probieren und mal in das Logfile /var/log/samba/log.smbd reinschauen, was der smbd nicht mag.

samba.org/samba/docs/using_samba/ch06.html
%u Current Unix username
%U Requested client username (not always used by Samba)

Viele Grüße
froeschchen

Hallo froeschchen,
hab ich auch schon probiert. Unter UCS scheint das includen von configfiles mit Variablen nicht zu funktionieren.
Die Fehlermeldung ist immer das er die zu inkludierende configfile nicht finden kann.

testparm sagt :

mit %U
Can’t find include file /etc/samba/hide.d/Share/.conf
Was klar ist denn mit testparm ist %U nicht belegt

mit %u
Can’t find include file /etc/samba/hide.d/Share/%u.conf

Bei neustart des samba
service samba restart
[…] Stopping Samba AD DC daemon: sambaERROR(runtime): uncaught exception - Unable to load default file
File “/usr/lib/python2.7/dist-packages/samba/netcmd/init.py”, line 175, in _run
return self.run(*args, **kwargs)
File “/usr/lib/python2.7/dist-packages/samba/netcmd/processes.py”, line 57, in run
lp = sambaopts.get_loadparm()
File “/usr/lib/python2.7/dist-packages/samba/getopt.py”, line 92, in get_loadparm
self._lp.load_default()
. ok
[…] Stopping SMB/CIFS daemon: smbdstart-stop-daemon: warning: failed to kill 27236: No such process
. ok
[ ok ] Stopping NetBIOS name server: nmbd.
[ ok ] Starting NetBIOS name server: nmbd.
[ ok ] Starting SMB/CIFS daemon: smbd.
Samba is not configured as AD DC.

log.smbd sagt auch nich viel:
[2016/11/28 16:12:22.376756, 1, pid=12461] …/source3/profile/profile_dummy.c:30(set_profile_level)
INFO: Profiling support unavailable in this build.
[2016/11/28 16:12:22.585434, 0, pid=12462] …/lib/util/become_daemon.c:124(daemon_ready)
STATUS=daemon ‘smbd’ finished starting up and ready to serve connections
[2016/11/28 16:12:22.587656, 1, pid=12462] …/source3/printing/printer_list.c:234(printer_list_get_last_refresh)
Failed to fetch record!

Von mir falsch gesehen der smbd startet aber nicht im AD modus
Also nicht so :
root 27236 0.0 0.3 518512 58228 ? Ss Nov22 0:48 /usr/sbin/smbd -D --option=server role check:inhibit=yes --foreground
root 27252 0.0 0.2 518512 38248 ? S Nov22 0:03 /usr/sbin/smbd -D --option=server role check:inhibit=yes --foreground

sondern so:
12462 ? Ss 0:00 /usr/sbin/smbd -D
12490 ? S 0:00 /usr/sbin/smbd -D
12492 ? S 0:00 /usr/sbin/smbd -D

Hängt es vielleicht mit dem AD zusammen ?

Hallo peatsn,

vom Prinzip her sollte das so funktionieren:

mkdir /var/shares/testuser; chown testuser /var/shares/testuser

echo 'include = /etc/samba/hide.d/Share/%U.conf' 
  >> /etc/samba/local.conf

ucr commit /etc/samba/smb.conf   ## so local,conf get's included in smb.conf

echo > /etc/samba/hide.d/Share/testuser.conf' <<%EOF
## Example share config
## If the special Samba specific [homes] share is enabled, it's important
## to choose a share name here that is different from the user name
## otherwise it will get hidden in the shadow of the [homes] share.
## On the other hand, if it's strictly desired to use the username here, then
## the [homes] share needs to be disabled. In UCS this can be achived by:
##  root@server:~$ ucr set samba/share/home=no; service samba restart
[ExampleTestuserShare]
path = /var/shares/testuser
vfs objects = acl_xattr
msdfs root = no
writeable = yes
browseable = yes
public = no
dos filemode = no
hide unreadable = no
create mode = 0744
directory mode = 0755
force create mode = 00
force directory mode = 00
locking = 1
blocking locks = 1
strict locking = Auto
oplocks = 1
level2 oplocks = 1
fake oplocks = 0
csc policy = manual
nt acl support = 1
inherit acls = 1
inherit owner = no
inherit permissions = no
%EOF

service samba restart
smbclient -L localhost -Utestuser
smbclient //localhost/ExampleTestuserShare -Utestuser -c showconnect
Mastodon