ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

RH135测试题

2020-12-07 09:30:04  阅读:135  来源: 互联网

标签:RH135 测试题 root westos html 172.25 com localhost


RH135

1.请设定您虚拟机server 和 client 的基本信息要求如下

@@@@在server主机中:@@@@
*建立sshd服务的秘钥认证,认证用户为root,
秘钥下载地址为http://172.25.254.250/exam/id_rsa.pub

*设定root用户密码为westos

*IPADDRESS=172.25.254.120
GATEWAY=172.25.254.250
DNS=172.25.254.250

*搭建本地软件仓库并可以使直连网络主机使用仓库地址 http://172.25.254.120/rhel8

*在主机中添加两块硬盘要求如下
vdb 5G
vdc 5G

@@@@在client主机中:@@@@

*建立sshd服务的秘钥认证,认证用户为root,
秘钥下载地址为http://172.25.254.250/exam/id_rsa.pub

*设定root用户密码为westos

*IPADDRESS=172.25.254.220
GATEWAY=172.25.254.250
DNS=172.25.254.250

*搭建本地软件仓库并可以使直连网络主机使用仓库地址 http://172.25.254.120/rhel8

2.在vdb中建立分区并完成以下要求

1*新建分区/dev/vdb1,大小为500M,并把设备做为swap分区激活

2*新建分区/dev/vdb2,大小100M,并把设备挂载到/westos_pub目录中 设定/westos_pub目录对所有人可写,确保westos用户只能使用50M的数据空间

3*新建lvm设备,组名称为westos_vg,pe大小为2M,在westos_vg中建立westos_datal逻辑卷 把逻辑卷挂载到/westos/westoslv中

注意:以上操作确保在开机时仍然生效

3.开启系统中的selinux并设定默认状态为强制模式

vim /etc/sysconfig/selinux
----> enforcing

4.部署ftp服务可以实现匿名用户的上传功能

1.semanage fcontext -a -t public_content_rw_t ‘/var/ftp/pub(/.*)?’----->修改上传目录安全上下文为rw
2.restorecon -RvvF /var/ftp/pub/
[root@localhost Desktop]# ls -Zd /var/ftp/pub/
system_u:object_r:public_content_rw_t:s0 /var/ftp/pub/
3.setsebool -P ftpd_anon_write on -P 永久打开 ------->打开写开关
[root@localhost Desktop]# getsebool -a | grep ftp
ftpd_anon_write --> on

vim /etc/vsftpd/vsftpd.conf
anon_upload_enable=YES
anonymous_enable=YES
systemctl restart vsftpd

[root@localhost Desktop]# ls -ld /var/ftp/pub/ ---->上传目录的权限
drwxrwxr-x. 2 root ftp 20 Nov 29 09:25 /var/ftp/pub/

5.部署apache要求如下

1*设定apache的默认发布目录为/westos/html并确保默认发布内容和下列文件一致

http://172.25.254.250/exam/index_default
default page

mkdir /westos/html -p
vim /etc/httpd/conf/httpd.conf

DocumentRoot “/westos/html”

<Directory “/westos/html”>
AllowOverride None
# Allow open access:
Require all granted

chcon -Rt httpd_sys_content_t /westos/html----->可以semange使用永久修改
[root@localhost ~]# ls -Zd /westos/html/
unconfined_u:object_r:httpd_sys_content_t:s0 /westos/html/

[root@localhost ~]# cat /westos/html/index.html
default page
systemctl restart httpd

http://172.25.254.120/
default page

2*设定虚拟主机bbs.westos.com 确保当前主机中的解析成立,默认发布页面内容和下列文件一致

http://172.25.254.250/exam/index_bbs
bbs page

[root@localhost conf.d]# mkdir /westos/bbs.com/html -p
[root@localhost conf.d]# ls -Zd /westos/bbs.com/html
unconfined_u:object_r:default_t:s0 /westos/bbs.com/html
[root@localhost conf.d]# chcon -Rt httpd_sys_content_t /westos/bbs.westos.com/html
chcon: cannot access ‘/westos/bbs.westos.com/html’: No such file or directory
[root@localhost conf.d]# chcon -Rt httpd_sys_content_t /westos/bbs.com/html
[root@localhost conf.d]# vim /westos/bbs.com/html/index.html
[root@localhost conf.d]# cat /westos/bbs.com/html/index.html
bbs page
[root@localhost conf.d]# vim vhost.conf
[root@localhost conf.d]# systemctl restart httpd
[root@localhost conf.d]# cat /etc/httpd/conf.d/vhost.conf

DocumentRoot /westos/html
CustomLog logs/default.log combined

<VirtualHost *:80>
ServerName bbs.westos.com
DocumentRoot /westos/bbs.com/html
CustomLog logs/bbs.log combined

<Directory /westos/bbs.com/html>
Require all granted

测试
vim /etc/hosts
172.25.254.120 www.westos.com bbs.westos.com

http://bbs.westos.com/
bbs page

http://www.westos.com/
default page

6.配置 iSCSI 服务

1*在 server120 上安装服务端程序,设置开机自启,防火墙允许此服务
dnf install targetcli -y
firewall-cmd --permanent --add-service=iscsi-target
firewall-cmd --reload

2*在vdb磁盘上分一个1G大小的LVM分区,用以创建逻辑卷组iSCSI_vg和一个100M大小的逻辑卷disk1_lv
eg : /dev/vdb4 1G ----->格式化
pvcreate /dev/vdb4
vgcreate iSCSI_vg /dev/vdb4
lvcreate -L 100M -n disk1_lv

3*使用 disk1_lv 作为 iSCSI 的后端存储名称为 server120.disk1

targetcli
/>backstores/block create server120.disk1 disk1_lv

4*定义IQN为 iqn.2020-04.com.westos:server120

/iscsi create iqn.2020-04.com.westos:server120

5*设置ACL允许initiator name为iqn.2020-04.com.westos:client220的客户端可以连接 程序监听172.25.254.120的3260端口

/iscsi/iqn.2020-04.com.westos:server120/tpg1/luns create /backstores/block/server120.disk1
/iscsi/iqn.2020-04.com.westos:server120/tpg1/acls create iqn.2020-04.com.westos:westoskey
systemctl restart target
6*client安装客户端程序,连接server120的iSCSI目标资源到本地 用以创建一个xfs文件系统,并开机自动挂载到/iscsidisk
dnf install iscsi-initiator-utils -y
vim /etc/iscsi/initiatorname.iscsi
InitiatorName= iqn.2020-04.com.westos:server120:westoskey
systemctl restart iscsid
iscsiadm -m node -T iqn.2020-04.com.westos:server120 -p 172.25.254.120 -l
fdisk -l
会看到一块多出来的设备sda
fdisk /dev/sda ------> /dev/sda1 ----mkfs.xfs /dev/sda1 ---->
mkdir /iscsidisk
vim /etc/fstab
/dev/sda1 /iscsidisk xfs default,_netdev 0 0

7.配置 Mariadb 数据库服务:

1*在 server120上安装 mariadb 数据库,开机自启动,防火墙允许此服务。 给数据库设置 root 管理员密码为 westos 限制 root 用户只能从localhost 登录,移除匿名用户,删除 test 库。

---->? root 用户登录数据库的时候不能用-h ip的形式登录

2*创建一个名为 redhat 的库,并从备份文件中恢复数据到此数据库, 备份文件的位置在: http://classroom.example.com/pub/materials/mariadb/mariadb.dump 。

----->?建立目录,备份在此目录

3*创建数据库用户 mary ,对 redhat 数据库具有查询、插入、更新、删除权限 密码为 mary_passwd natasha 用户可以从 client120上登录数据库, 对 redhat 库拥有查询权限,密码为natasha_passwd 。
m

------>? 授权

8.配 SMB 服务

1*在 server120 上配置 smb 共享服务,要求开机自启,防火墙允许此服务。

2*创建共享目录为 /smbshare ,共享名为 smbshare , marketing 组成员可以读写此共享 不属于marketing 组的人只能读


-#####
直接在本机中做的测试,所以安装客户端
dnf install samba samba-client samba-common
systemctl enable --now smb
firewall-cmd --permanent --add-service=samba
firewall-cmd --reload
mkdir /smbshare
chcon -t samba_share_t /smbshare/
cp /etc/samba/smb.conf.example /etc/samba/smb.conf
vim /etc/samba/smb.conf
314 [smbshare]
315 comment = smb
316 path = /smbshare
317 write list = +marketing —>只写文件,建立用户只是为了测试
318
systemctl restart smbshare
[root@localhost ~]# smbclient -L //172.25.254.120/smbshare
Enter MYGROUP\root’s password:
Anonymous login successful

Sharename       Type      Comment
---------       ----      -------
smbshare        Disk      smb
IPC$            IPC       IPC Service (Samba Server Version 4.11.2)

SMB1 disabled – no workgroup available
chmod 777 /sambashare
useradd marketing
useradd linux
smbpasswd -a marketing
smbpasswd -a linux

[root@localhost ~]# pdbedit -L
marketing:1003:
linux:1001:

[root@localhost ~]# mount -o username=linux,password=westos //172.25.254.120/smbshare /mnt
[root@localhost ~]# df
//172.25.254.120/smbshare 9450496 4739344 4711152 51% /mnt
[root@localhost ~]# cd /mnt/
[root@localhost mnt]# ls
file
[root@localhost mnt]# touch westos
touch: cannot touch ‘westos’: Permission denied

[root@localhost mnt]# usermod -G marketing linux

[root@localhost ~]# umount /mnt
[root@localhost ~]# mount -o username=linux,password=westos //172.25.254.120/smbshare /mnt

[root@localhost ~]# cd /mnt/
[root@localhost mnt]# ls
file
[root@localhost mnt]# touch westos
[root@localhost mnt]# ls
file westos
3*创建 samba-only 用户 brian 和 rob 其中 brian 用户属于marketing 组,用户密码都是 westos
[root@localhost ~]# useradd -s /sbin/nologin brian -M

[root@localhost ~]# useradd -s /sbin/nologin rob -M
[root@localhost ~]# smbpasswd -a brian
New SMB password:
Retype new SMB password:
Added user brian.
[root@localhost ~]# smbpasswd -a rob
New SMB password:
Retype new SMB password:
Added user rob.
[root@localhost ~]# pdbedit -L
marketing:1003:
brian:1005:
linux:1001:
rob:1006:
[root@localhost ~]# usermod -G marketing brian
[root@localhost ~]# id brian
uid=1005(brian) gid=1005(brian) groups=1005(brian),1003(marketing)

----->brian相当于 linux

4*在 client120 上建立挂载点 /mnt/multiuser 目录 开机自动挂载server120 上的 smbshare 共享 激活 smb 多用户挂载支持。

----->客户端在安装autofs,cifs-utils
samba客户端的多用户挂载,支持访问samba共享的用户身份,
但不需要重新挂载资源。挂载参数需要添加multiuser参数
,客户机上的普通用户可以通过cifscreds提交新的身份凭据,
在客户端挂载samba共享目录,需要软件包cifs-util的支持
,为访问网络资源配置开机挂载时,
注意添加参数_netdev,
表示等客户机网络配置可用后才挂载对应资源

dnf install cifs-utils

[root@westos_student4 ~]# vim /etc/auto.master

/mnt /etc/auto.cifs

[root@westos_student4 ~]# vim /etc/auto.cifs
multiuser -fstype=cifs,credentials=/root/smbauth,multiuser,sec=ntlmssp ://172.25.254.120/smbshare
[root@westos_student4 ~]# vim /root/smbauth
username=linux
password=westos

[root@westos_student4 ~]# su - kiosk
Last login: 一 12月 7 03:32:58 CST 2020 on tty2
[kiosk@westos_student4 ~]$ cd /mnt/
[kiosk@westos_student4 mnt]$ cd multiuser
[kiosk@westos_student4 multiuser]$ df

//172.25.254.120/smbshare 9450496 4747716 4702780 51% /mnt/multiuser
[kiosk@westos_student4 multiuser]$ ll
ls: cannot open directory ‘.’: Permission denied
[kiosk@westos_student4 multiuser]$ cifscreds add -u linux 172.25.254.120 —>linux (服务端主机的samba用户)
Password:
[kiosk@westos_student4 multiuser]$ ll
total 0
-rwxr-xr-x. 1 kiosk kiosk 0 12月 7 04:33 file
-rwxr-xr-x. 1 kiosk kiosk 0 12月 7 04:36 westos

标签:RH135,测试题,root,westos,html,172.25,com,localhost
来源: https://blog.csdn.net/ninimino/article/details/110791158

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有