LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Samba Share restrict share by hostname (https://www.linuxquestions.org/questions/linux-newbie-8/samba-share-restrict-share-by-hostname-4175457868/)

gdizzle 04-12-2013 01:56 AM

Samba Share restrict share by hostname
 
Hi all,
I am trying to figure out to restrict a samba in a per share instance by hostname. I already have this working with IP Address like this:

Code:


vim /etc/samba/smb.conf

[Testfolder]
        comment = testfolder
        path = /testfolder
        create mask = 0777
        guest ok = yes
        hosts allow = 192.168.10.1 127.0.0.1

If I change the hosts allow to the hostnames of the computer (yes which I have tested I can ping etc from the server) this does not work.

Does anyone have a working example of a samba per share restriction by hostname?

Thanks

michaelk 04-12-2013 08:13 AM

If you specify hosts allow in the global section it will take precedence over the share. However, I assume that there isn't anything configured for hostname lookup. i.e. /etc/hosts file or network browsing. I also assume that your samba clients do not use static IP address.

http://www.samba.org/samba/docs/man/...kBrowsing.html

gdizzle 04-14-2013 07:38 PM

Hi michaelk,
Thanks for your reply here is the full /etc/samba/smb.conf:

Code:

[global]
        workgroup = Test
        server string = Test01
        smb passwd file = /etc/samba/smbpasswd
        log file = /var/log/samba/%m.log
        max log size = 50
        printcap name = /etc/printcap
        dns proxy = No
        idmap config * : backend = tdb
        cups options = raw
        security = user
        map to guest = bad user

[Testfolder]
        comment = testfolder
        path = /testfolder
        create mask = 0777
        guest ok = yes
        hosts allow = wstest.example.com

I have been looking around online and I cannot see any examples from a per share basis in the smb.conf where it uses a workstation name, only IP, and I am not willing to really make them static in /etc/hosts as these clients may loose there dhcp lease in time, so I am trying to keep this dynamic.

So I am wondering if samba can filter by computer name?

I am not going to join this to the Windows Domain, as it's using Tivoli Identity Manager to manage the accounts (yes I know another hurdle), and I have not found anything like that with Samba yet.


Thanks

gdizzle 04-14-2013 08:44 PM

Ok found an example:

http://www.samba.org/samba/docs/man/...mb.conf.5.html for "hosts allow" .


All times are GMT -5. The time now is 07:42 PM.