搭建一个samba服务器,公司员工无法再“网络邻居”中查看到非本部门的共享目录
时间: 2024-02-16 13:03:16 浏览: 65
好的,以下是搭建Samba服务器并设置访问权限的步骤:
1. 安装Samba软件:
```
sudo apt-get update
sudo apt-get install samba
```
2. 创建结算中心和技术部门的目录,并设置权限:
```
sudo mkdir /srv/samba/settlement
sudo mkdir /srv/samba/tech
sudo chmod -R 770 /srv/samba/settlement
sudo chmod -R 770 /srv/samba/tech
```
3. 添加用户和组:
```
sudo addgroup smbgroup-settlement
sudo addgroup smbgroup-tech
sudo adduser smbuser1
sudo adduser smbuser2
sudo adduser smbuser3
sudo usermod -a -G smbgroup-settlement smbuser1
sudo usermod -a -G smbgroup-settlement smbuser2
sudo usermod -a -G smbgroup-tech smbuser1
sudo usermod -a -G smbgroup-tech smbuser3
```
4. 配置Samba服务器:
```
sudo nano /etc/samba/smb.conf
```
在文件末尾添加以下内容:
```
[settlement]
comment = Settlement Center Share
path = /srv/samba/settlement
browseable = no
valid users = @smbgroup-settlement, smbuser1, smbuser2
read only = no
available = yes
browseable = no
[tech]
comment = Tech Department Share
path = /srv/samba/tech
browseable = no
valid users = @smbgroup-tech, smbuser1, smbuser3
read only = no
available = yes
browseable = no
```
5. 禁用“网络邻居”中的公告服务:
```
sudo nano /etc/samba/smb.conf
```
在文件末尾添加以下内容:
```
[global]
announce version = 5.0
announce as = nobody
disable netbios = yes
```
6. 重启Samba服务:
```
sudo systemctl restart smbd
```
现在,公司员工无法在“网络邻居”中查看到非本部门的共享目录。注意,为了保证安全,建议修改Samba服务器的配置文件,指定只有特定的用户或组可以访问该共享目录。
阅读全文