Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to give Read and Write access based on the IPs instead of the Users in SAMBA using smb.conf

This is the Text I copied from my smb.conf file.

[TEST]
        comment = test
        path = /mnt/vg-stg/storage/test
        read only = no
        writeable = yes
        oplocks = yes
        level2 oplocks = yes
        force security mode = 0
        dos filemode = yes
        dos filetime resolution = yes
        dos filetimes = yes
        fake directory create times = no
   browseable = yes
   csc policy = manual
   veto oplock files = /*.mdb/*.MDB/*.dbf/*.DBF/
   veto files = /*:Zone.Identifier:*/
   store dos attributes = yes
   map acl inherit = yes
        create mode = 0777
        directory mode = 2777
        printable = no
        guest ok = yes
        hosts allow = 10.20.20.213
        #hosts readonly allow =

[TEST]
        comment = test
        path = /mnt/vg-stg/storage/test
        read only = yes
        writeable = no
        oplocks = yes
        level2 oplocks = yes
        force security mode = 0
        dos filemode = yes
        dos filetime resolution = yes
        dos filetimes = yes
        fake directory create times = no
   browseable = yes
   csc policy = manual
   veto oplock files = /*.mdb/*.MDB/*.dbf/*.DBF/
   veto files = /*:Zone.Identifier:*/
   store dos attributes = yes
   map acl inherit = yes
        create mode = 0777
        directory mode = 2777
        printable = no
        guest ok = yes
        hosts allow = 10.20.20.147
        #hosts readonly allow =

But the Samba is not picking up the changes. Because when i try to access from explorer or Nautilus it is giving me error

Could not display "smb://XXX.XXX.XXX.XXX/Reports
The file is of an unknown type

Please give me advice what im doing wrong here

share|improve this question
add comment

1 Answer

I don't think the options hosts readonly allow and hosts write list exist. btw: my samba/testparm do not either. theoretically this should do what you expect:

[mainBak]
comment = Main Backup Writeable
    path = /mnt/vg-stg/storage/Main_Backup
    read only = no
    writeable = yes
    oplocks = yes
    level2 oplocks = yes
    force security mode = 0
    dos filemode = no
    dos filetime resolution = no
    dos filetimes = no
    fake directory create times = no
browseable = yes
csc policy = manual
veto oplock files = /*.mdb/*.MDB/*.dbf/*.DBF/
veto files = /*:Zone.Identifier:*/
store dos attributes = yes
map acl inherit = yes
    create mode = 0777
    directory mode = 2777
    printable = no
    guest ok = yes
    hosts allow = 10.91.12.109 10.91.12.115 10.91.12.95 10.91.12.67 10.91.12.109 10.91.12.115 10.20.20.147

[mainBak]
comment = Main Backup Readonly
        path = /mnt/vg-stg/storage/Main_Backup
        read only = yes
        writeable = no
        oplocks = yes
        level2 oplocks = yes
    force security mode = 0
    dos filemode = no
    dos filetime resolution = no
    dos filetimes = no
    fake directory create times = no
browseable = yes
csc policy = manual
veto oplock files = /*.mdb/*.MDB/*.dbf/*.DBF/
veto files = /*:Zone.Identifier:*/
store dos attributes = yes
map acl inherit = yes
    create mode = 0777
    directory mode = 2777
    printable = no
    guest ok = yes
    hosts allow = 10.20.20.0/24 10.20.50.0/24 172.16.0.0/16 192.168.0.0/16 10.91.12.252 10.20.20.94 10.91.12.46 10.91.12.197 10.91.12.87 10.91.12.106 10.91.12.110 10.91.12.12 10.91.12.108 10.91.12.62 10.91.12.129 10.91.12.127 10.91.12.128 10.91.12.50 10.91.12.142

Idea is to have same Name for share two times, but with different write-/read-rights and host-allows. If this is the only share you have in your config, you could export some options/settings to [global] to reduce redundancy.

access-check you could do with: testparm /path/to/smb.conf hostname hostIP

share|improve this answer
    
Thanks for replying xx4h, I thought that it will work but this time I created a test folder TEST and assigned permissions READ ONLY = YES, WRITEABLE =NO (On First Machine) and READ ONLY = NO, WRITEABLE =YES (On Second Machine). On First M. it is not opening folder and on Second Machine it is asking for the password. I have updated the Question on the TEST SCENARIO. –  OmiPenguin May 15 '13 at 7:54
add comment

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.