SMB 配置

A little Mew
2021-09-21 12:22
67
0
  1. 一劳永逸关闭selinux
## 临时关闭
setenforce 0
## 永久关闭
sudo vim /etc/sysconfig/selinux
SELINUX=disabled
  1. 添加账户
## 添加linux账户
adduser username

## 添加对应smb账户
smbpasswd -a username
  1. 创建配置 sudo vim /etc/samba/smb.conf
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.
[global]
  ## 工作组
  workgroup = WORKGROUP
  ## 安全模式用户 允许匿名 默认 nobody
  security = user
  map to guest = Bad User
  guest account = nobody
        ## wins 服务
        wins support = yes
        local master = yes
        prefered master = yes
        domain master = yes 
        os level = 99
  ## Samba Server 的注释
  #server string = 局域网服务器%v
  ## windwos访问时候的主机名字
  netbios name = Server
  ## 用户后台 设置密码认证的方式
  passdb backend = tdbsam
  ## 日志文件
  log file = /tmp/smb_%m.log.txt
  ## 日志大小 kb
  max log size = 10240
  ## nmdb成为windows客户端的时间服务器
  time server = yes
[data]
  ## 共享描述,任意字符串
  comment = 数据,仅ROOT管理员
  path = /data
  ## 允许的用户
  valid users = root,nobody
  guest ok = yes
  ## 允许写入的用户
  write list = root,nobody
  ## 是否允许浏览
  browseable = no
  ## 只读
  read only = yes
  ## 打印机的共享设置
  inherit acls = Yes
  1. 挂载SMB
mount -t cifs -o username=xxxx,password=xxxx //192.168.1.1/downloads/ /opt/static/downloads/

全部评论