samba 服务配置

一、samba服务端配置

  • 添加系统用户和用户组,添加用户到samba用户里
    sudo useradd smb -u 6000 -g 6000 -s /sbin/nologin -d /dev/null
    sudo smbpasswd -a smb
    
  • 修改samba主配置文件 /etc/samba/smb.conf
    [global]
    #workgroup = WORKGROUP
    #server string = Samba Server %v
    #netbios name = centos
    security = user
    #map to guest = bad user
    #dns proxy = no
    #============================ Share Definitions ============================== 
    [share-dir]
    path = /mnt/smb-server
    available = yes
    writable = yes
    valid users = smb
    #guest ok = yes
    public = yes
    read only = no
    browseable = yes
    
    create mask = 0777
    directory mask = 0777
    force user = nobody
    force group = nogroup
    

二、windows 客户端配置

通过网络访问 \\IP 即可

三、linux 客户端配置

安装相关软件包
sudo apt install samba-client cifs-utils -y

挂载命令
sudo mount -t cifs -o username=smb,password=xx,iocharset=utf8 //10.208.68.xxx/share /mnt/test/

注意,iocharset 这个参数一定要设置

linux 挂载报错问题

挂载后无法对共享文件夹实现读写功能,需要修改的是mount 的参数配置
https://qa.1r1g.com/sf/ask/954205731/

posted @ 2023-04-11 12:03  风风羊  阅读(59)  评论(0编辑  收藏  举报