Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to block access to some Samba shares from a certain machine, but somehow I can't get it to work: the machine can still access the shares, and I did restart and reload the samba daemon.

Here is a part of my configuration:

    security = share
    hosts allow = 127.0.0.1 192.168.1.0/24
    interfaces = 127.0.0.1 eth1 192.168.1.2
    bind interfaces only = yes
    hosts deny = 192.168.1.251
    encrypt passwords = yes
    guest ok = yes

The shares themselves look like this:

[examples]
    comment = Example
    path = /foo/bar
    read only = No
    guest ok = yes

What am I doing wrong here?

share|improve this question
    
Have you tried 192.168.1. instead of 192.168.1.0/24 ? Also which version of Samba are you using ? Does your config apply to [global] ? –  drcelus Jun 22 '12 at 10:42
    
tried that now, does not seem to make a difference. Version is 3.5.10-114.fc12 and yes it is in the [global] section –  datadevil Jun 22 '12 at 11:29

2 Answers 2

Found the answer, at least a working solution:

I removed the hosts deny line, and changed that hosts allow as follows:

    hosts allow = 127.0.0.1 192.168.1. EXCEPT 192.168.1.251
share|improve this answer

Correction: For the machines you want to block access to set the "browseable= no". This field may vary depending on the version of Samba your using

share|improve this answer
    
can you please explain? How do I set browseable=no for specific machines? –  datadevil Jun 28 '12 at 8:01
    
sorry for the delay. at the very bottom of the /etc/smb.conf file you should add the browseable=no option. For example [host ] \\ My example of a machine path = /home/host writable = yes valid users = <<browsable = no >>> add this field for each machine listed in you config file that you want to block admin users = public = yes guest ok = yes force user = nobody create mask = 777 directory mask = 777 –  Al_ Aug 23 '12 at 3:38

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.