0

I have a samba share and I want to make some changes for security. Today everybody can read and write my files. It's not safe. I'd like to do the these things:

1- set up for everybody just read files

2- set and allow just to people with their IPs & Mac Address allowed to write

2

If you want to give only read permission and not write permission, open up your configuration file, the path to which is /etc/samba/smb.conf

Inside this file, move down to the share name of your directory. Now there must be an option write list. Either comment this or remove this option. This will now not allow anyone to write. To give read permissions, use these 2 options -

brosweable=yes
valid users=User1 user2 user3 

Now to allow only hosts from particular IP addresses, use option hosts allow.

hosts allow=IP_of_host.

For example, if share name of your directory is abc, then your configuration for this file should like this:

[abc]
path=/abc
browseable=yes
valid users=john mike
hosts allow=127.0.0.0/24     // it must be IP of hosts you want to allow

Save your configuration file, enable service samba on firewall, and restart services smb nmb .

4
  • I'd recommend read only = yes be added as an explicit instruction too the share definition.
    – roaima
    Apr 2 '17 at 12:52
  • It would definitely be helpful adding that option. Thanks for your suggestion. Apr 2 '17 at 15:46
  • I need specific ips and macs to write and not just read.
    – Bulfaitelo
    Apr 2 '17 at 23:02
  • In write list option mention names of people whom you want to give write permission, and you'll need to provide credentials to the client to give write permission. Apr 3 '17 at 2:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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