[root@kvm5 ~]# yum -y install samba
[root@kvm5 ~]# mkdir /groupdir
[root@kvm5 ~]# touch /groupdir/file1 [root@kvm5 ~]# touch /groupdir/file2
samba_share_t,不先查詢,使用 TAB 鍵一樣會出現提示及補齊。
[root@kvm5 ~]# semanage fcontext -a -t samba_share_t '/groupdir(/.*)?'
samba_share_t。
[root@kvm5 ~]# restorecon -Rv /groupdir restorecon reset /groupdir context unconfined_u:object_r:default_t:s0->system_u:object_r:samba_share_t:s0
[root@kvm5 ~]# vim /etc/samba/smb.conf [root@kvm5 ~]# tail -5 /etc/samba/smb.conf [common] path = /groupdir browseable = yes hosts allow = 192.168.122.
[root@kvm5 ~]# testparm Load smb config files from /etc/samba/smb.conf rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384) Processing section "[homes]" Processing section "[printers]" Processing section "[print$]" Processing section "[common]" Loaded services file OK. Server role: ROLE_STANDALONE Press enter to see a dump of your service definitions # Global parameters [global] printcap name = cups security = USER workgroup = SAMBA idmap config * : backend = tdb cups options = raw [homes] browseable = No comment = Home Directories inherit acls = Yes read only = No valid users = %S %D%w%S [printers] browseable = No comment = All Printers create mask = 0600 path = /var/tmp printable = Yes [print$] comment = Printer Drivers create mask = 0664 directory mask = 0775 force group = @printadmin path = /var/lib/samba/drivers write list = @printadmin root [common] hosts allow = 192.168.122. path = /groupdir
[root@kvm5 ~]# yum -y install samba-client
[root@kvm5 ~]# useradd deyu1
[root@kvm5 ~]# smbpasswd -a deyu1 New SMB password: Retype new SMB password: Added user deyu1.
[root@kvm5 ~]# pdbedit -L deyu1:1000:
[root@kvm5 ~]# systemctl enable smb.service ln -s '/usr/lib/systemd/system/smb.service' '/etc/systemd/system/multi-user.target.wants/smb.service'
[root@kvm5 ~]# systemctl start smb.service
[root@kvm5 ~]# smbclient -L //kvm5.deyu.wang/common -U deyu1%123qwe Sharename Type Comment --------- ---- ------- print$ Disk Printer Drivers common Disk IPC$ IPC IPC Service (Samba 4.7.1) deyu1 Disk Home Directories Reconnecting with SMB1 for workgroup listing. Server Comment --------- ------- Workgroup Master --------- ------- SAMBA KVM5