Ubuntu上设置Samba的配置文件和CentOS有一些不同,增加了一个很方便的默认配置。这个默认配置为每个用户提供了访问自己家目录的设置。只需要取消注释,就可以直接访问,非常方便。

给出我的Samba配置。

# Un-comment the following (and tweak the other settings below to suit)
# to enable the default home directory shares. This will share each
# user's home directory as \\server\username
[homes]
   comment = Home Directories
;  browseable = no

# 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 = 0775

# 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 = 0775

# 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
# This might need tweaking when using external authentication schemes
   valid users = luqiuwen

选用密码验证后端为:

# If you are using encrypted passwords, Samba will need to know what
# password database type you are using. 
   passdb backend = tdbsam

然后增加tdb用户

$ sudo pdbedit -a luqiuwen

输入密码。

启动smb服务

$ sudo systemctl start smbd
$ sudo systemctl enable smbd

在Windows上访问:
\\192.168.44.140\luqiuwen,输入刚才设置的密码即可。


luqiuwen
34 声望0 粉丝

引用和评论

0 条评论