samba

Posted dinghailong128

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了samba相关的知识,希望对你有一定的参考价值。

服务端:

[root@linuxprobe ~]# yum install samba -y

[root@linuxprobe ~]# mv /etc/samba/smb.conf /etc/samba/smb.bak

[root@linuxprobe ~]# cat /etc/samba/smb.bak | grep -v "#" | grep -v ";" | grep -v "^$" > /etc/samba/smb.conf

[root@linuxprobe ~]# vim /etc/samba/smb.conf

[global]

        workgroup = MYGROUP

        server string = Samba Server Version %v

        log file = /var/log/samba/log.%m

        max log size = 50

        security = user

        passdb backend = tdbsam

[rick]

        comment = ding

        path = /rick

        public = no

        writable = yes

 

[root@linuxprobe ~]# systemctl restart smb

[root@linuxprobe ~]# systemctl enable smb

ln -s ‘/usr/lib/systemd/system/smb.service‘ ‘/etc/systemd/system/multi-user.target.wants/smb.service‘

 

[root@linuxprobe ~]# id linuxprobe

uid=1000(linuxprobe) gid=1000(linuxprobe) groups=1000(linuxprobe)

[root@linuxprobe ~]# pdbedit -a -u linuxprobe

new password:

retype new password:

Unix username:        linuxprobe

 

[root@linuxprobe ~]# mkdir -p /rick

[root@linuxprobe ~]# chown -Rf linuxprobe:linuxprobe /rick

[root@linuxprobe ~]# chmod -Rf 777 /rick

[root@linuxprobe ~]# getsebool -a | grep samba

samba_create_home_dirs --> off

samba_domain_controller --> off

samba_enable_home_dirs --> off

samba_export_all_ro --> off

samba_export_all_rw --> off

samba_portmapper --> off

samba_run_unconfined --> off

samba_share_fusefs --> off

samba_share_nfs --> off

sanlock_use_samba --> off

use_samba_home_dirs --> off

virt_sandbox_use_samba --> off

virt_use_samba --> off

[root@linuxprobe ~]# setsebool -P samba_export_all_rw=on

[root@linuxprobe ~]# iptables -F

[root@linuxprobe ~]# service iptables  save

iptables: Saving firewall rules to /etc/sysconfig/iptables:[  OK  ]

客户端:

[root@localhost ~]# yum install cifs-utils -y

[root@localhost ~]# vim auth.smb

username=linuxprobe

password=ding

domain=MYGROUP

[root@localhost ~]# vim /etc/fstab

[root@localhost ~]# mkdir /rick

[root@localhost ~]# vim /etc/fstab

//192.168.10.10/rick /rick cifs credentials=/root/auth.smb 0 0

[root@localhost ~]# mount -a

[root@localhost ~]# df -h

//192.168.10.10/rick    18G  3.0G   15G  17% /rick

 

以上是关于samba的主要内容,如果未能解决你的问题,请参考以下文章

smb(samba)服务

常见方案--远程开发代码同步

samba 部署和优化

linux 安装 Samba服务

一文把samba相关的都说清楚

Linux-Samba或NFS实现文件共享