编程知识 cdmana.com

centos 8安装Samba服务器及配置

1首先通过命令查看samba的安装情况 rpm -ql | grep samba
centos 8安装Samba服务器及配置
查看centos版本
[root@localhost ~]# rpm -q centos-release
centos-release-8.1-1.1911.0.8.el8.x86_64
2在线安装samba服务器 yum -y install samba




centos 8安装Samba服务器及配置
3查看samba服务配置文件
root@localhost ~]# gedit /etc/samba/smb.conf
配置文件内容如下


[global]
workgroup = SAMBA
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
4关闭系统核心防护及防火墙功能
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld
setenforce 0  (PS:这里是关闭SELinux服务,如果要打开则setenforce 1) 
vi /etc/sysconfig/selinux 把里边的一行改为 SELINUX=disabled关闭防火墙






























5查看服务是否启动(查看端口号是否开启)
[root@localhost ~]# netstat -antp | grep -E "139|445"

centos 8安装Samba服务器及配置
6 在/home/创建文件夹A和shared
[root@localhost ~]# mkdir A
[root@localhost ~]# mkdir shared


7 更改文件夹A和shared权限为777(任意用户可读可写可执行)
[root@localhost ~]# chmod 777 A
[root@localhost ~]#chmod 777 shared

8 增加两个账户wjy,syj
[root@localhost ~]#useradd wjy
[root@localhost ~]#useradd syj

9 为wjy,和syj创建samba密码
[root@localhost ~]#smbpasswd -a wjy
[root@localhost ~]#smbpasswd -a syj
centos 8安装Samba服务器及配置
还有一种创建samba账户的方法
pdbedit -a 系统用户
[root@localhost ~]#pdbedit -a wjy
[root@localhost ~]#pdbedit -a syj






10查看ip地址
[root@localhost~]#ifconfig
centos 8安装Samba服务器及配置
11更改/etc/samba/smb.conf 可以复制粘贴,[root@localhost~] sudo gedit /etc/samba/smb.conf


[global]
workgroup = WorkGroup
security = user
passdb backend = tdbsam
map to guest = bad user
[公共文件]
comment = 公共文件
browseable=yes
path = /home/A
guest ok = yes








[个人]
comment = 个人
path = /home/shared
browseable=yes
create mask=0644
directory mask=0755
valid users=wjy
write list=wjy






[组]
comment =组
path = /home/shared
browseable=yes
create mask=0644
directory mask=0755
valid users=syj,wjy
write list=syj,wjy
12开启samba服务或者重启samba
[root@localhost ~]# systemctl start smb
[root@localhost ~]# systemctl restart smb
centos 8安装Samba服务器及配置
13测试方法如另一篇Ubuntu 20.04.1安装Samba服务器及配置一样
centos 8安装Samba服务器及配置
centos 8安装Samba服务器及配置













版权声明
本文为[osc_vpxa23em]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4324616/blog/4837284

Scroll to Top