Samba文件共享服务

安装Samba

$ yum install samba -y
$ cd /etc/samba/
$ ls
lmhosts  smb.conf  smb.conf.example
$ mv smb.conf smb.conf.bak
$ grep -v "#" smb.conf.bak > smb.conf 

配置文件smb.conf

[root@localhost samba]# vim smb.conf

[global]
        workgroup = SAMBA
        security = user 

        passdb backend = tdbsam

        printing = cups
        printcap name = cups
        load printers = yes
        cups options = raw
[myshare]
                path=/opt/wbm  ##共享文件目录路径         
                browseable=yes
                create mask=0644
                directory mask=0755
                valid users=wbm  ##允许访问的用户                
                write list=wbm  ##允许写入的用户

创建用户并设置密码

$ useradd wbm
# 给用户设置密码 
$ smbpasswd -a wbm 
# 列出smb用户列表
$ pdbedit -L  
wbm:1000:

创建Samba共享目录

$ mkdir /opt/wbm
$ chmod 777 /opt/wbm
$ systemctl start smb.service 

挂载samba共享

$ mount -t cifs //192.168.10.21/wbm /opt/wbm/ -o username=wbm,password=qwer1.2.3.
$ /opt/wbm/
$ ls
Install_nginx.sh

开机自动挂载

$ vim /etc/fstab
# 在末尾处添加
//192.168.10.21 /opt/wbm    cifs username=wbm,password=qwer1.2.3. 0 0

你可能感兴趣的:(Samba文件共享服务)