Samba安装和配置。

1.安装Samba。
[root@centos8 ~]# yum -y install samba samba-client
2.配置主配置文件。
1)基于身份验证的用户。

[HR]
		        comment = 人事部			描述
		        path = /benet/HR		文件的绝对路径
		        valid users = @HR		允许访问的用户
		        guest ok = yes			全部允许(任选其一)
		        readonly list = @HR		只读的用户组
		        readonly list = yes		全部用户只读(任选其一)
		        write list = bob		允许写入的用户
		        directory mask = 0775	默认创建目录权限 rwxrwxr_x
		        create mask = 0775		默认创建文件权限 rwxrwxr_x

[root@centos8 /]# chmod o+w /benet/HR
[root@centos8 /]# pdbedit -a -u bob 将系统用户转化为samba用户
[root@centos8 /]# pdbedit -vL 查看创建的用户信息
[root@centos8 /]# pdbedit -x -u tom 移除samba用户
[root@centos8 /]# smbclient -L 查看samba的共享
//192.168.200.80 -U bob
[root@centos8 /]# smbclient -U bob //192.168.200.80/HR 查看共享的内容
smb: > ls
[root@centos8 /]# mount -o username=bob //192.168.200.80/HR /mnt 将samba共享挂载到本地
在这里插入图片描述
2)匿名访问。

[global]
		        workgroup = SAMBA
		        security = user
		        passdb backend = tdbsam
		        map to guest = Bad User		添加此行内容
		[HR]
		        comment = 人事部
		        path = /benet/HR
				write list = bob
		        public = yes				允许匿名访问
		        create mask = 0775
		        directory mask = 0775

[root@centos8 /]# chmod o+w /benet/HR
3)启动samba。
[root@centos8 /]# systemctl restart smb
[root@centos8 /]# systemctl restart nmb
4)连接samba。
在这里插入图片描述

发布了52 篇原创文章 · 获赞 4 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/HCY_2315/article/details/103184978
今日推荐