ubuntu 安装samba共享服务

参考博客:https://blog.csdn.net/sinat_36116187/article/details/106898872

1 安装samba

sudo apt-get update
sudo apt-get install samba

2 添加当前用户到samba

比如说我现在的用户是good

smbpasswd -a good

设置密码即可

设置共享该用户的home目录

打开/etc/samba/smb.conf 修改home配置

[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 = 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 = %S

如果不是想分析home文件夹,那么可以单独指定,比如自己在文件最下面添加:

[download]    #共享目录名,访问时的展示名
    comment = download       #该共享目录的描述
    path = /home/good/download  #访问的实际路径,前面设置的
    valid users = good       #设置可访问的用户,此处为前面添加的用户smbuser(注>意users不要拼写错误)
    guest ok = no               #是否允许访客,否
    writable = yes              #可写,是
    browsable = yes             #可浏览,是

重启服务:

service smbd restart
service nmbd restart

然后在windows的资源管理器中输入:

\\192.168.18.200/good

或你自己设置的download

\\192.168.18.200/download

就可以了

文章目录