centos 7安装samba 设置文件共享

1、检查是否已经安装

rpm -qa |grep samba

2、安装

yum -y install samba

3、配置samba

修改之前先备份下 cp /etc/samba/smb.conf /etc/samba/smb.back.conf

vim /etc/samba/smb.conf

配置文件的内容如下,其他的可以直接删除([axure]代表的是共享文件名):
注意:不要使用security = share 也不要使用,也不要配置guest,window 10安全策略不允许,需要配置账户

[global]
        workgroup = SAMBA
        log file = /var/log/samba/log.%m
        max log size = 50
        passdb backend = tdbsam
        printing = cups
        printcap name = cups
        load printers = no
        cups options = raw
        security = user
        #map to guest = bad user
[axure] 
        comment= Axure share
        path = /data/axure
        public = no
        writable = yes
        available = yes
        browsable = yes
        create mask = 0777
        directory mask = 0777

保存后用testparm验证配置文件是否正确

4、配置用户

  1. 添加系统用户(用户名为axure ,如果文件用户文件存在的话也没关系)
    useradd -d /data/axure -s /sbin/nologin axure
  2. 把用户添加到samba用户,填2次密码确定
    pdbedit -a -u axure

5、创建文件和设置权限

mkdir /data/axure
chmod 777 /data/axure

6、配置samba开机启动和重启等

systemctl enable smb
systemctl start smb
systemctl status smb
systemctl restart smb

7、访问共享文件

  1. window:win+r直接\\ip 填账号密码就行了
  2. mac:访达->前往->连接服务器 smb://ip
posted @ 2021-12-09 18:40  nickchou  阅读(160)  评论(0编辑  收藏  举报