如何禁止 Samba 共享中的可执行文件?

如何禁止 Samba 共享中的可执行文件?

我想设置一个 Samba 共享以便在我的内联网上共享文件。

  1. 有什么办法可以禁止某些类型的文件(例如*.exe)上传到共享文件夹?

  2. 如何强制用户在首次登录时更改密码?

答案1

当谈到文件/目录权限时,请记住 Samba地图Windows 位到 Unix 位。

Windows 的archive位映射到执行位。如果您想要创建没有该x位的文件,请执行以下操作:

[global]
    map archive = no

有关权限的更多信息:https://www.samba.org/samba/docs/using_samba/ch08.html

答案2

我从这里找到了一个很棒的教程红帽Linux

配置 SAMBA 服务器

Step 1.mkdir /samba
Step 2.chmod a+w /samba
Step 3.yum install samba -y
Step 4.vim /etc/samba/smb.conf
    [public]
        comment = Only users
        path = /samba
        public = yes
        browseable=yes
        writable = yes
        printable = no
        write list = +staff
Step 5.service smb restart

文件中可以提供的选项

Step 1.If browseable=yes ->we CAN see the shared dir
  If browseable=no -> we CANNOT see the shared dir
Step 2.If public=yes    ->Allows anonymous Login
  If public=no     ->Stops  anonymous Login
Step 3.writable = no     ->uploading is denied  for BOTH the users.
   writable = yes    ->uploading is allowed for BOTH the users
Step 4
     a. writable =no +   ->Allows only u1 to upload files, but
     b. write list =u1   both writable=no and writelist=u1 shuld b enabled
Step 5.hosts allow=127. 192.168.0.20 ->Allow only 192.168.0.20 ip to access share, other ips are denied

客户端命令

Step 1.smbclient -L //192.168.0.48/share  ->List directories shared
Step 2. smbclient //192.168.0.48/share   ->Anonymous Login
   get <file>
   put <file>     
Step 3a. To generat passwd to allow for non-anonymous login
      1. smbpasswd -a u1
      2. service smb restart 
Step 3b. smbclient //192.168.0.48/share -U u1  ->Non Anonymous Login
    get <file>
    put <file>

相关内容