CentOS 7.6 SAMBA服务安装与测试

CentOS 7.6 SAMBA服务安装与测试

#安装SAMBA服务和SAMBA客户端

yum install samba samba-client -y

#关闭防火墙和SELINUX

systemctl stop firewalld
setenforence 0

#永久关闭SELINUX

vi /etc/selinux/config

#把enforcing改为disabled

#修改smb.conf

vi /etc/samba/smb.conf
# See smb.conf.example for a more detailed config file or
# read the smb.conf manpage.
# Run 'testparm' to verify the config is correct after
# you modified it.

[global]
	workgroup = WORKGROUP
	security = user

	passdb backend = tdbsam

#	printing = cups
#	printcap name = cups
#	load printers = yes
#	cups options = raw

[homes]
	comment = Home Directories
	valid users = %S, %D%w%S
	browseable = No
	read only = No
	inherit acls = Yes
	
#不需要打印机共享,注释掉
#[printers]
#	comment = All Printers
#	path = /var/tmp
#	printable = Yes
#	create mask = 0600
#	browseable = No
#
#[print$]
#	comment = Printer Drivers
#	path = /var/lib/samba/drivers
#	write list = @printadmin root
#	force group = @printadmin
#	create mask = 0664
#	directory mask = 0775

#启动smb服务并设置开机自动启动

systemctl start smb
systemctl enable smb

#设置samba登陆帐号

useradd test1
pdbedit -a -u test1
mkdir /home/test1
chown test1 /home/test1
chgrp test1 /home/test1

#使用smbclient测试samba服务

smbclient -L 127.0.0.1 -U test1
Enter WORKGROUP\test1's password: 

	Sharename       Type      Comment
	---------       ----      -------
	IPC$            IPC       IPC Service 
	test1           Disk      Home Directories
Reconnecting with SMB1 for workgroup listing.

	Server               Comment
	---------            -------

	Workgroup            Master
	---------            -------

#DONE.


版权声明:本文为m0_37504201原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。