centos8 samba安装

centos 安装samba

  • 安装Samba
    rpm -qa|grep samba
    yum install samba

  • 关闭selinux和防火墙
    setenforce 0
    sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
    systemctl stop firewalld
    systemctl disable firewalld

  • 启动samba
    systemctl start smb

  • 配置Samba服务
    cd /home/
    mkdir logger shared
    useradd -s /sbin/nologin logadmin
    useradd -g logadmin -s /sbin/nologin loguser
    useradd -s /sbin/nologin admin
    useradd -g admin -s /sbin/nologin shared

  • 建立Samba用户
    smbpasswd -a logadmin
    smbpasswd -a loguser
    smbpasswd -a admin
    smbpasswd -a shared

  • 更改目录属性
    chown logadmin.logadmin logger
    chown admin.admin shared
    chmod -R 777 logger
    chmod -R 777 shared

  • 查看Samba配置文件
    samba文件共享默认配置文件存放于/etc/samba/smb.conf下, 用于配置Samba服务内容。


[global]
    workgroup = SC.LOCAL
    server string = Samba Server Version %v
    netbios name = Linuxidc-Server
    log file = /var/log/samba/%m.log
    max log size = 10240
    security = user
    passdb backend = tdbsam

[logger]
    comment = Logs Directories
    path = /home/logger/
    public = no
    admin users = logadmin
    valid users = @logadmin
    browseable = yes
    writable = yes
    create mask = 0777
    directory mask = 0777
    force directory mode = 0777
    force create mode = 0777

[shared]
    # 共享文件目录描述
    comment = Shared Directories
    # 共享文件目录
    path = /home/shared/
    # 是否允许guest访问
    public = no
    # 指定管理用户
    admin users = admin
    # 可访问的用户组、用户
    valid users = @admin
    # 是否浏览权限
    browseable = yes
    # 是否可写权限
    writable = yes
    # 文件权限设置
    create mask = 0777
    directory mask = 0777
    force directory mode = 0777
    force create mode = 0777
  • 修改完Samba配置文件后,需要重启Samba服务配置才能生效
    systemctl restart smb
    systemctl status smb

centos8 samba安装_第1张图片
centos8 samba安装_第2张图片
centos8 samba安装_第3张图片

你可能感兴趣的:(linux)