Samba alatt könyvtár elrejtése, openwrt rendszeren

Fórumok

Üdv!

Openwrt rendszeren akarom ezt a kis trükköt (?) megoldani, de amikor újraindítom a szolgáltatást, akkor figyelmen kívül hagyja a következő sort:
option 'veto_files' '/mnt/adatok/munka/'

Pedig a samba doksija szerint ezzel lehetne elrejteni. Más ötlet vagy tipp ennek a megoldására? Az is jó ha le lehet védeni jelszóval.

Hozzászólások

"figyelmen kívül hagyja a következő sort: option 'veto_files' '/mnt/adatok/munka/'"
"a samba doksija szerint ezzel lehetne elrejteni."
És mást is ír:
man smb.conf, veto files (S):

"Each entry in the list must be separated by a '/'"
"Each entry must be a unix path, not a DOS path and must not include the unix directory separator '/'."

Ezért az általad megadott

option 'veto_files' '/mnt/adatok/munka/'

nem lesz jó, ha a /mnt/adatok/munka könyvtár alatti file-okat szeretnéd elérhetetlenné tenni. És például az option miatt sem.

Az option mindenféleképpen kell neki az openwrt miatt. Viszont ha kiveszem akkor is figyelmen kívül hagyja. Nem értem én ezt.

dash: Pontosan, ahogy mondod.

Zahy: Ha csak annyit írok, hogy munka akkor is kihagyja.

Ugye nekem ezeket a /etc/config/samba fájlba kell írni és a végén a rendszer a /tmp/smb.conf fájlba generálja a véglegeset. Viszont ott nem akar sehogysem megjelenni ez a sor.

---------------------
http://tothszabi.info

szerintem (szigorúan a man szerint, mert ezt még az életben nem használtam)


veto files = munka

formában kellene írni, és reménykedni, hogy sehol másutt nincs munka nevű fájlod vagy könyvtárad, mert a többi ilyet se fogod látni.

Az option vonatkozásában részben igazad volt. Megnéztem az OpenWRT dokumentációját, amelyet bizonyára te is tüzetesen átolvastál előtte. Ebben írnak róla. De még előtte, rögtön az első sor ez: "For installation instructions see Samba How To". Ebben pedig ez áll: "So, if for whatever reasons above configuration does not give you desired access to your configured shares, you can of course circumvent the uci system and hack the original samba configuration files instead or in addition. There may be entries which do not have a counterpart in UCI (yet) and thus can only be configured that way." Ezt kipróbáltad már? Mert ebben ott van, hogy mely opciókat ismeri ez a bizonyos UCI - és a "veto files" nincs közük -, valamint hogy miként írhatsz kézzel rendes samba konfigot. Ezek után pedig a már leírtak szerint megadhatod ezt is.

Na, akkor megosztom a saját configomat. A veto kivételével minden megy...

config 'samba'
option 'name' 'server'
option 'description' 'server'
option 'workgroup' 'lan'
option 'homes' '0'
option 'security' 'share'

config 'sambashare'
option 'read_only' 'no'
option 'create_mask' '0777'
option 'dir_mask' '0777'
option 'name' 'media'
option 'path' '/mnt/adatok'
option 'guest_ok' 'yes'
option 'veto_files' 'munka'

config 'sambashare'
option 'name' 'letoltesek'
option 'path' '/mnt/adatok/downloads'
option 'read_only' 'no'
option 'create_mask' '0777'
option 'dir_mask' '0777'
option 'guest_ok' 'yes'

config 'sambashare'
option 'name' 'munka'
option 'path' '/mnt/adatok/munka'
option 'read_only' 'no'
option 'create_mask' '0777'
option 'dir_mask' '0777'
option 'guest_ok' 'no'
option 'valid users' 'root'

---------------------
http://tothszabi.info

"A veto kivételével minden megy..."
Ahogy az előző hozzászólásban idéztem, az UCI nem ismeri. Ott a módszer a natív samba konfig írására. Kipróbáltad?

"option 'veto_files' 'munka'"
Az opció neve nem veto_files. Továbbá a dokumentáció első hozzászólásban linkelt és kiemelt része szerint: "Each entry in the list must be separated by a '/'". Illetve még egyértelműbben: "each entry must begin, end, or be separated from another with a slash ( / ) character, even if only one pattern is listed".

Hello!
Nekem működik a veto files de nem a teljes elérési utat megadva, hanem a megosztott mappához relatívan.

veto files = /lomtar/*.pif/*.cmd/autorun.inf/*.iso/*.nrg/*.mds/*.mdf/*.exe/

ahol a lomtar nevű mappa nálam fizikailag az /mnt/sambashare/share/lomtar útvonalon van

Még mindig a már többször linkelt manualra tudok hivatkozni. Ez az opció címe: "veto files (S)". S, mint service specific. Nem G, mint global. Szóval nyugodtan tedd be share alá. Ahogy már előzőleg is linkeltem, a hivatalos leírás szerint: "If you want configure samba directly with /etc/samba/smb.conf instead of /etc/config/samba, it is possible to make changes to the smb.conf survive a reboot". Illetve ahogy TommyB írta feljebb, "de akkor globális beállítás lesz, a másik megoldás az /etc/init.d/samba script módosítása". Vagy esetleg megpróbáltad mindkettőt, és egyik sem működik?

Az a baj, hogy ha a template részében oda írom, ahol lennie kell. Jelen esetben:

[media]
veto files = /munka/*
veto files = /www/*

Akkor 2x hozza létre a [media] megosztást és nem működik. Az egyikben csak a veto rész van, míg a másikban a tényleges beállítások, elérések.

---------------------
http://tothszabi.info

Ezzel két probléma is van.
1.) Miért duplán veszed fel?
2.) A szintaxis sem jó. Ez is szerepelt már itt a topikban:
"Each entry in the list must be separated by a '/'"
"Each entry must be a unix path, not a DOS path and must not include the unix directory separator '/'."
"each entry must begin, end, or be separated from another with a slash ( / ) character, even if only one pattern is listed"

Felvettem a rendes /etc/config/samba alá, ahol ugye a UCI nem tudja értelmezni a veto files-t. Ide ment minden és a template-be ment a veto files rész.
A / jeleket javítottam...

Valami ötlet, hogy ne legyen ennyire gány?

Most ez a kimenete a /tmp/smb.conf fájlnak:

root@Server:~# cat /tmp/smb.conf
[global]
netbios name = server
workgroup = lan
server string = server
syslog = 10
encrypt passwords = true
passdb backend = smbpasswd
obey pam restrictions = yes
socket options = TCP_NODELAY
unix charset = UTF-8
preferred master = yes
os level = 20
security = share
guest account = nobody
#invalid users = root
smb passwd file = /etc/samba/smbpasswd
hosts allow = 127.0.0.1 192.168.1.0/24
hosts deny = 0.0.0.0/0
veto files = /munka/*/
veto files = /www/*/

[media]
path = /mnt/adatok
read only = no
guest ok = yes
create mask = 0777
directory mask = 0777

[letoltesek]
path = /mnt/adatok/downloads
read only = no
guest ok = yes
create mask = 0777
directory mask = 0777

[munka]
path = /mnt/adatok/munka
valid users = root
read only = no
guest ok = no
create mask = 0777
directory mask = 0777
root@Server:~#
root@Server:~# nano /etc/config/samba
root@Server:~# nano /etc/samba/smb.conf.template
root@Server:~# /etc/init.d/samba restart
root@Server:~# cat /tmp/smb.conf
[global]
netbios name = server
workgroup = lan
server string = server
syslog = 10
encrypt passwords = true
passdb backend = smbpasswd
obey pam restrictions = yes
socket options = TCP_NODELAY
unix charset = UTF-8
preferred master = yes
os level = 20
security = share
guest account = nobody
#invalid users = root
smb passwd file = /etc/samba/smbpasswd
hosts allow = 127.0.0.1 192.168.1.0/24
hosts deny = 0.0.0.0/0

[media]
veto files = /munka/*/
veto files = /www/*/
path = /mnt/adatok
read only = no
guest ok = yes
create mask = 0777
directory mask = 0777

[letoltesek]
path = /mnt/adatok/downloads
read only = no
guest ok = yes
create mask = 0777
directory mask = 0777

[munka]
path = /mnt/adatok/munka
valid users = root
read only = no
guest ok = no
create mask = 0777
directory mask = 0777

---------------------
http://tothszabi.info

Szerintem el kellene dönteni, hogy követed a dokumentációban leírtakat, vagy más úton közelíted meg a kérdést. Többször hivatkoztam már az OpenWRT howtoban írtakra. Itt vázolták, hogy mi a baj az UCI-val, hogyan lehet a Samba indítását letiltani és manuálisan engedélyzni, hogy ne íródjon felül az /etc/samba/smb.conf, és ezek után szabadon írhatod a /etc/samba/smb.conf-ot. Tehát nem /etc/config/samba, hanem /etc/samba/smb.conf.

A veto files pedig így néz ki, TommyB már adott kipróbált példát is:

veto files = /www/munka/

Az rendben is van, hogy vázolták, hogy disabled, ellenben így nekem manuálisan kell minden egyes újraindítás után elindítani a szolgáltatást. Áramkimaradás, összeomlik a rendszer...
Én valami kevésbé drasztikus módszerre gondoltam.

Az általad megadott veto opcióval tökéletesen megy a rendszer. Köszönöm. :)

---------------------
http://tothszabi.info

"ellenben így nekem manuálisan kell minden egyes újraindítás után elindítani a szolgáltatást"

Ahogy olvastad a már hivatkozott dokumentációt:
"Then add the following lines to /etc/rc.local to allow smbd and nmbd to start at boot time, using /etc/samba/smb.conf as the configuration file

smbd -D
nmbd -D"

Tehát ez az rc.local módszer a valóságban mégsem működik?

Elvileg mennie kellene:

# cat /etc/rc.local
# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

exit 0

Vagy be kell linkelni a megfelelő indító parancsokat tartalmazó szkriptecskét a /etc/rc.d -be. Nálam nincs samba. Így néz ki a mappa tartalma:

# ls -la /etc/rc.d
drwxr-xr-x    2 root     root         1024 Nov 10 12:59 .
drwxr-xr-x   25 root     root         3072 Nov 12 17:42 ..
lrwxrwxrwx    1 root     root           14 Nov 10 12:41 K50sshd -> ../init.d/sshd
lrwxrwxrwx    1 root     root           17 Mar 27  2010 K90network -> ../init.d/network
lrwxrwxrwx    1 root     root           18 Mar 27  2010 K95luci_bwc -> ../init.d/luci_bwc
lrwxrwxrwx    1 root     root           22 Mar 27  2010 K95luci_fixtime -> ../init.d/luci_fixtime
lrwxrwxrwx    1 root     root           14 Mar 27  2010 K98boot -> ../init.d/boot
lrwxrwxrwx    1 root     root           16 Mar 27  2010 K99umount -> ../init.d/umount
lrwxrwxrwx    1 root     root           19 Mar 27  2010 S05defconfig -> ../init.d/defconfig
lrwxrwxrwx    1 root     root           22 Mar 27  2010 S05luci_fixtime -> ../init.d/luci_fixtime
lrwxrwxrwx    1 root     root           14 Mar 27  2010 S10boot -> ../init.d/boot
lrwxrwxrwx    1 root     root           18 Nov  9 21:14 S15iptables -> ../init.d/iptables
lrwxrwxrwx    1 root     root           15 Mar 27  2010 S20fstab -> ../init.d/fstab
lrwxrwxrwx    1 root     root           13 Mar 27  2010 S39usb -> ../init.d/usb
lrwxrwxrwx    1 root     root           17 Mar 27  2010 S40network -> ../init.d/network
lrwxrwxrwx    1 root     root           14 Mar 27  2010 S50cron -> ../init.d/cron
lrwxrwxrwx    1 root     root           14 Nov 10 12:41 S50sshd -> ../init.d/sshd
lrwxrwxrwx    1 root     root           16 Nov  9 21:21 S50telnet -> ../init.d/telnet
lrwxrwxrwx    1 root     root           27 Mar 27  2010 S59luci_dhcp_migrate -> ../init.d/luci_dhcp_migrate
lrwxrwxrwx    1 root     root           15 Nov 10 12:59 S60dhcpd -> ../init.d/dhcpd
lrwxrwxrwx    1 root     root           14 Mar 27  2010 S95done -> ../init.d/done
lrwxrwxrwx    1 root     root           18 Mar 27  2010 S95luci_bwc -> ../init.d/luci_bwc
lrwxrwxrwx    1 root     root           16 Oct 30 10:29 S95smartd -> ../init.d/smartd
lrwxrwxrwx    1 root     root           13 Mar 27  2010 S96led -> ../init.d/led
lrwxrwxrwx    1 root     root           18 Mar 27  2010 S97watchdog -> ../init.d/watchdog
lrwxrwxrwx    1 root     root           16 Mar 27  2010 S99sysctl -> ../init.d/sysctl