2020-10-20 Ubuntu 16.04安装配置Samba服务每个用户可以用自己的用户名和密码登录自己的home目录以及共享特定的目录
程序员文章站
2022-06-13 21:22:40
...
Ubuntu 16.04安装配置Samba服务每个用户可以用自己的用户名和密码登录自己的home目录以及共享特定的目录
一、安装Samba命令
sudo apt-get install samba
二、查看samba版本确认是否安装ok
三、配置smb.conf文件 sudo vi /etc/samba/smb.conf,共享home和特定的目录,完整文件可以下载https://download.csdn.net/download/qq_37858386/12984331
找到[homes]项,此项默认是注释掉的,取消其注释,然后修改其具体内容,修改成如下:
[homes]
comment = Home Directories
browseable = yes
# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
read only = no
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
create mask = 0755 #建议将权限修改成0755,这样其它用户只是不能修改
# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
directory mask = 0755
# By default, \\server\username shares can be connected to by anyone
# with access to the samba server. Un-comment the following parameter
# to make sure that only "username" can connect to \\server\username
# The following parameter makes sure that only "username" can connect
#
# This might need tweaking when using external authentication schemes
valid users = %S #本行需要取消注释
四、增加samba用户,需要注意的是创建samba用户之前,必须先确保有一个同名的Linux用户,否则samba用户会创建失败。
sudo smbpasswd -a smbuser
五、重新启动samba
sudo service smbd restart
六、查看所有samba用户
sudo pdbedit -L
七、测试ok