IPを使用してSAMBAに読み取りおよび書き込み権限を付与する方法

IPを使用してSAMBAに読み取りおよび書き込み権限を付与する方法

SAMBAのユーザーの代わりにsmb.confを使用して、IPに基づいて読み取りおよび書き込みアクセスを許可したいと思います。

これはsmb.confファイルからコピーしたテキストです。

[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 =

しかし、Sambaはこの変化を受け入れなかった。 ExplorerまたはNautilusからアクセスしようとするとエラーが発生するためです。

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

私がここで何を間違っているかを提案してください。

ベストアンサー1

私はオプションhosts readonly allowhosts write list存在が存在しないと思います。注:私のサンバ/テストファームも同じです。理論的には、次のように動作するはずです。

[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

アイデアは、2回共有するために同じ名前を持ちますが、書き込み/読み取り権限とホスト権限は異なることです。これが設定の唯一の共有である場合は、いくつかのオプション/設定をエクスポートして[global]冗長性を減らすことができます。

小切手にアクセスするには:testparm /path/to/smb.conf hostname hostIP

おすすめ記事