samba安装

  1. samba安装
    1. 安装
    2. 配置

samba安装

安装

1
sudo apt install samba samba-common cifs-utils smbclient
  • 检查
    1
    2
    3
    samba -V
    # 结果
    Version 4.15.13-Ubuntu

    配置

  1. 创建共享目录
    1
    2
    3
    sudo mkdir /data
    sudo chown orangepi:orangepi /samba
    sudo chmod 775 /samba
  2. 建立登陆用户
    1
    2
    3
    4
    # 建立用户
    sudo useradd smile -s /usr/sbin/nologin
    # 设置登陆密码
    sudo smbpasswd -a smile
  3. 设置登陆用户对目录的权限
    1
    2
    3
    4
    5
    6
    ls -alh /data
    total 8.0K
    drwxr-xr-x 2 orangepi orangepi 4.0K Apr 1 16:19 .
    drwxr-xr-x 20 root root 4.0K Apr 1 16:19 ..
    # 添加登陆用户到当前组
    sudo usermod -aG $(whoami) smile
  4. 修改samba配置文件
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    sudo vim /etc/samba/smb.conf
    # 将下面的内容添加到最后(无密码登陆配置)
    [show]
    comment = share folder
    browseable = yes
    path = /data
    create mask = 0777
    directory mask = 0777
    valid users = smile
    public = yes
    available = yes
    writable = yes
  5. 重启samba服务
    1
    sudo service smbd restart
  6. windows填入路径示例
    1
    2
    \\192.168.10.55\secret
    \\192.168.10.55\show
  7. Ubuntu18.04特殊配置
    1
    2
    3
    4
    5
    6
    7
    8
    9
    → 修改前
    # Allow users who've been granted usershare privileges to create
    # public shares, not just authenticated ones
    usershare allow guests = yes
    → 修改后
    # Allow users who've been granted usershare privileges to create
    # public shares, not just authenticated ones
    usershare allow guests = yes
    ntlm auth = yes

微信:宏沉一笑
公众号:登山客

签名:Smile every day
名字:宏沉一笑
邮箱:whghcyx@outlook.com
个人网站:https://whg555.github.io



转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 whghcyx@outlook.com

文章标题:samba安装

文章字数:320

本文作者:宏沉一笑

发布时间:2024-04-01, 16:28:10

最后更新:2024-04-01, 17:02:41

原始链接:https://whghcyx.gitee.io/2024/04/01/%E5%AE%89%E8%A3%85-2024-04-01-samba%E5%AE%89%E8%A3%85/

版权声明: "署名-非商用-相同方式共享 4.0" 转载请保留原文链接及作者。

目录
×

喜欢就点赞,疼爱就打赏