Find the answer to your Linux question:
Results 1 to 2 of 2
Hello, I have been recently asked to block access to certain directories based on ip address. For example: The same user: - should have an access to directory A if ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jul 2011
    Location
    Sevenoaks, Kent, UK
    Posts
    5

    SAMBA: Blocking access to subdirectories per IP address


    Hello,

    I have been recently asked to block access to certain directories based on ip address.

    For example: The same user:
    - should have an access to directory A if he is connecting from x.x.x.x IP address, but he shouldnt have an access to directory B from that IP address
    - should have an access to directory B if he is connecting from y.y.y.y IP address, but he shouldnt have an access to directory A from that IP address

    Is it possible to implement that scenario in Samba?

    In apache it's easy by putting few <Location X> sections with a few directives, but I couldn't find any relevent configuration example in SAMBA.

    Kind Regards,
    Paul Preston

  2. #2
    Just Joined!
    Join Date
    Jun 2011
    Location
    Belgium
    Posts
    84
    It's possible to allow or deny access for each shared directory.
    You simply add 'hosts allow' or 'hosts deny' in /etc/samba/smb.conf for each sharename and restart the SAMBA service.
    It is also possible to allow/deny access for a group of IP addresses (ex.: hosts deny = 192.168.1., this allow all IP addresses started with '192.168.1.').
    See also '$> man 5 smb.conf' and search for hosts allow or hosts deny.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •