Ubuntu配置samba服务
时间: 2024-01-22 18:11:54 浏览: 78
1. 安装samba服务:
在终端中输入以下命令安装samba服务:
```
sudo apt-get update
sudo apt-get install samba
```
2. 创建共享文件夹:
在终端中输入以下命令创建共享文件夹:
```
sudo mkdir /home/share
sudo chmod 777 /home/share
```
3. 配置samba:
在终端中输入以下命令打开samba配置文件:
```
sudo nano /etc/samba/smb.conf
```
在文件中添加以下配置:
```
[share]
comment = Ubuntu File Share
path = /home/share
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
writable = yes
```
解释一下以上配置:
- [share]:共享文件夹名称
- comment:注释,可以随意填写
- path:共享文件夹路径
- valid users:允许访问共享文件夹的用户组
- force group:指定创建的文件所属的组
- create mask:新建文件的权限掩码
- directory mask:新建目录的权限掩码
- writable:是否可写
保存并退出samba配置文件。
4. 创建samba用户:
在终端中输入以下命令创建samba用户:
```
sudo smbpasswd -a <username>
```
其中,<username>是你的用户名。
5. 重启samba服务:
在终端中输入以下命令重启samba服务:
```
sudo /etc/init.d/smbd restart
```
至此,samba服务已经配置完成,可以在其他设备上通过网络访问共享文件夹了。
阅读全文
相关推荐














