全面分析rhce7(红帽认证工程师)考试题目之----nfs文件共享篇

author author     2022-10-08     277

关键词:

配置NFS共享(Linux与Linux之间)

Network Flie System 网络文件系统

 协议:NFS(TCP/UDP 2049),RPC(TCP/UDP 111)

所需软件包:nfs-utils (默认会装)

系统服务:nfs-server


搭建基本只读NFS服务

1.检测是否装包

[[email protected] ~]# rpm -q nfs-utils

nfs-utils-1.3.0-0.el7.x86_64

2.修改配置文件 /etc/exports

[[email protected] ~]# vim /etc/exports

 ...

  /public 172.25.0.0/24(ro)

 ...

[[email protected] ~]# mkdir /public

[[email protected] ~]# echo public test > /public/nsd.txt

3.重启nfs-server服务,设置开机自启

  [[email protected] ~]# systemctl restart nfs-server

[[email protected] ~]# systemctl enable nfs-server.service 

4.客户端 访问nfs-server服务

[[email protected] ~]# showmount -e 172.25.0.11

 Export list for 172.25.0.11:

 /public 172.25.0.0/24

[[email protected] ~]# mkdir /mnt/nfs

[[email protected] ~]# vim /etc/fstab 

 ...

  172.25.0.11:/public /mnt/nfs nfs _netdev 0 0

 ...

[[email protected] ~]# mount -a

[[email protected] ~]# df -h

 文件系统              容量  已用  可用 已用% 挂载点

 /dev/vda1              10G  3.1G  7.0G   31% /

 devtmpfs              906M     0  906M    0% /dev

 tmpfs                 921M   80K  921M    1% /dev/shm

 tmpfs                 921M   17M  904M    2% /run

 tmpfs                 921M     0  921M    0% /sys/fs/cgroup

 172.25.0.11:/public    10G  3.1G  7.0G   31% /mnt/nfs

[[email protected] ~]# ls /mnt/nfs/

 nsd.txt


搭建root用户的读写NFS

[[email protected] ~]# mkdir /abc

[[email protected] ~]# echo 123 > /abc/a.txt

[[email protected] ~]# vim /etc/exports

...

/abc 172.25.0.0/24(rw)

...

[[email protected] ~]# systemctl restart nfs-server.service


[[email protected] ~]# vim /etc/fstab 

...

172.25.0.11:/abc /mnt/test nfs _netdev 0 0

...


[[email protected] ~]# mount -a

[[email protected] ~]# df -h

文件系统              容量  已用  可用 已用% 挂载点

/dev/vda1              10G  3.1G  7.0G   31% /

devtmpfs              906M     0  906M    0% /dev

tmpfs                 921M   80K  921M    1% /dev/shm

tmpfs                 921M   17M  904M    2% /run

tmpfs                 921M     0  921M    0% /sys/fs/cgroup

//172.25.0.11/common   10G  3.1G  7.0G   31% /mnt/samba

//172.25.0.11/devops   10G  3.1G  7.0G   31% /mnt/dev

172.25.0.11:/abc       10G  3.1G  7.0G   31% /mnt/test


[[email protected] test]# touch 123.txt

touch: 无法创建"123.txt": 权限不够

第一种

[[email protected] ~]# vim /etc/exports

...

/abc 172.25.0.0/24(rw,no_root_squash)  #no_root_squash 不压榨客户端root的权限

...

[[email protected] ~]# systemctl restart nfs


[[email protected] test]# systemctl restart nfs#重启客户端服务

[[email protected] test]# touch 123.txt

[[email protected] test]# ls /mnt/test/

123.txt  a.txt




第二种 提权方法

[[email protected] ~]# setfacl -m u:nfsnobody:rwx /abc

[[email protected] ~]# getfacl /abc

getfacl: Removing leading '/' from absolute path names

# file: abc

# owner: root

# group: root

user::rwx

user:nfsnobody:rwx

group::r-x

mask::rwx

other::r-x




普通用户

客户端普通用户访问服务器端nfs-server服务,服务端会以客户端相同UID身份的本地用户进行权限判定

 

[[email protected] ~]# useradd -u 1666 test01

[[email protected] ~]# setfacl -m u:test01:rwx /abc


[[email protected] ~]# useradd -u 1666 li 

[[email protected] ~]# su - li


[[email protected] ~]$ cd /mnt/test/

[[email protected] test]$ touch 10.txt

[[email protected] test]$ ls

10.txt  123.txt  1.txt  3.txt  a.txt

   



安全NFS服务

LDAP : 网络用户,提供用户名

kerberos:密码验证

1.服务端修改配置文件,创建读写的共享

[[email protected] ~]# mkdir /protected

[[email protected] ~]# vim /etc/exports

...

/protected *(rw,sec=krb5p)

...

2.服务端和客户端部署加密密钥    这里是使用在网上下载的密钥

[[email protected] ~]# wget http://172.25.254.254/pub/keytabs/server0.keytab -O /etc/krb5.keytab

[[email protected] ~]# wget http://172.25.254.254/pub/keytabs/desktop0.keytab -O /etc/krb5.keytab

3.服务端 nfs-server nfs-secure-server 重启

[[email protected] ~]# systemctl restart nfs-server nfs-secure-server

[[email protected] ~]# systemctl enable nfs-server nfs-secure-server

4.保证ldapuser0用户有写权限,设置本地权限

[[email protected] ~]# chown ldapuser0 /test  #备用


[[email protected] ~]# setfacl -m u:ldapuser0:rwx /protected


5.客户端访问与挂载

[[email protected] ~]# showmount -e 172.25.0.11

Export list for 172.25.0.11:

/test *

[[email protected] ~]# mkdir /mnt/nfs

[[email protected] ~]# vim /etc/fstab 

...

172.25.0.11:/protected /mnt/nfs nfs _netdev,sec=krb5p 0 0

...

6.重启相关服务

[[email protected] ~]# systemctl restart nfs nfs-secure

7.验证挂载

[[email protected] ~]# mount -a

[[email protected] ~]# df -h

文件系统           容量  已用   可用    已用% 挂载点

/dev/vda1         10G  3.1G  7.0G   31% /

devtmpfs           906M     0  906M    0% /dev

tmpfs             921M   80K  921M    1% /dev/shm

tmpfs              921M   17M  904M    2% /run

tmpfs             921M     0  921M    0% /sys/fs/cgroup

172.25.0.11:/protected  10G   3.1G  6.9G   31% /mnt/nfs


8.验证写入

[[email protected] ~]# ssh [email protected]

[email protected]'s password: kerberos


[[email protected] ~]$ cd /mnt/nfs/

[[email protected] nfs]$ touch 1.txt

[[email protected] nfs]$ ls

1.txt


在RHCE7的考试中有两道题是关于nfs的:


配置NFS共享服务


        在 server0 配置 NFS 服务,要求如下:

        以只读的方式共享目录 /public,只能被 example.com 域中的系统访问

        以读写的方式共享目录 /protected,只能被 example.com 域中的系统访问

        访问 /protected 需要通过 Kerberos 安全加密,您可以使用下面 URL 提供的密钥:http://classroom.example.com/pub/keytabs/server0.keytab

        目录 /protected 应该包含名为 project 拥有人为 ldapuser0 的子目录

        用户 ldapuser0 能以读写方式访问 /protected/project

        

        [[email protected] ~]#mkdir -p /public /protected/project

        [[email protected] ~]#chown ldapuser0 /protected/project/

        [[email protected] ~]#wget -O /etc/krb5.keytab http://classroom/pub/keytabs/server0.keytab

        [[email protected] ~]#vim /etc/exports

        /public172.25.0.0/24(ro)

        /protected172.25.0.0/24(rw,sec=krb5p)

        

        [[email protected] ~]#systemctl start nfs-secure-server nfs-server

        [[email protected] ~]#systemctl enable nfs-secure-server nfs-server

        

        

挂载NFS共享


        在 desktop0 上挂载一个来自 server0.example.com 的共享,并符合下列要求:

        /public 挂载在下面的目录上 /mnt/nfsmount

        /protected 挂载在下面的目录上 /mnt/nfssecure 并使用安全的方式,密钥下载 URL:http://classroom.example.com/pub/keytabs/desktop0.keytab

        用户 ldapuser0 能够在/mnt/nfssecure/project 上创建文件

        这些文件系统在系统启动时自动挂载

        

        [[email protected] ~]#mkdir -p /mnt/nfsmount /mnt/nfssecure

        [[email protected] ~]#wget -O /etc/krb5.keytab http://classroom/pub/keytabs/desktop0.keytab

        [[email protected] ~]#systemctl start nfs-secure

        [[email protected] ~]#systemctl enable nfs-secure

        [[email protected] ~]#showmount -e server0

        [[email protected] ~]#vim /etc/fstab

        server0.example.com:/public     /mnt/nfsmount   nfs     _netdev         0 0

        server0.example.com:/protected  /mnt/nfssecure  nfs     sec=krb5p,_netdev       0 0

        [[email protected] ~]#mount -a 

        [[email protected] ~]#ssh [email protected]

        

        

        经常遇见的问题:

        # mount  -a

        .... Permission Denied。

        可能的原因:

        1)服务端的 /etc/exports配置没有给权限(比如忘记写掩码长度)

        2)服务端的 nfs-secure-server 服务没开启

        3)客户端的 nfs-secure 服务没开启

        4)密钥部署的名称不对、内容不对


        

全面分析rhce7(红帽认证工程师)考试题目之---firewall(防火墙)篇

防火墙策略管理(firewall)作用:隔离 局域网和外网之间 阻止入站,允许出站 软件防火墙 系统服务:firewalld 管理工具:firewall-cmd(命令工具、Linux7),firewell-config(图形工具)查看防火墙服务状态 [[email protected]~]#systemctlstatusfirewa... 查看详情

全面分析rhce7(红帽认证工程师)考试题目之----nfs文件共享篇

配置NFS共享(Linux与Linux之间)NetworkFlieSystem网络文件系统 协议:NFS(TCP/UDP2049),RPC(TCP/UDP111)所需软件包:nfs-utils(默认会装)系统服务:nfs-server搭建基本只读NFS服务1.检测是否装包[[email protected]~]#rpm-qnfs-utilsnfs-utils-1.3.0... 查看详情

全面分析rhce7(红帽认证工程师)考试题目之----配置ipv6地址,配置聚合连接篇

配置聚合连接(网卡绑定) team,聚合连接(也称为链路聚合) 由多块网卡一起组建而成的虚拟网卡 作用1:轮询式(roundrobin)的流量负载均衡 作用2:热备份(activebackup)连接冗余 热备份配置:{"runner":{"name":"ac... 查看详情

全面分析rhce(红帽认证工程师)考试题目之----alias(自定义别名)篇

自定义命令alias别名设置 alias[别名名称]#查看已设计的别名 alias别名名称='实际执行命令行' #定义新的别名 unalias[别名名称] #取消以设置的别名 配置文件  用户个性化配置文件 影响指定用户的bash解释环境 ~/.bashrc(用... 查看详情

红帽linux认证培训怎么样?

...HCTRHCE英文全称:RedHatCertifiedEngineer,中文全称:红帽认证工程师RHCERHCA英文全称:RedHatCertifiedArchitect,中文全称:红帽认证架构师RHCARHCSS英文全称:RedHatCertifiedSecuritySpecialist,中文全称:红帽认证安全专家RHCSSRHCT是RedHat的入门级... 查看详情

软件架构了解

...级,分别是RHCSA(红帽认证系统管理员)、RHCE(红帽认证工程师)、 RHCA(红帽认证的系统架 查看详情

rhce7系列—rhce考试

本篇主要以RHCE练习题为线索,介绍其中涉及的知识点。红色引用的字为题目要求(不是正式题目,难度略低于正式题目)InserverXordesktopX1.(labteambridgesetup[inserverX])ConfigureLinkAggregationinserverXwithconfig“activebackup”ip“192.168.0.11... 查看详情

rhce7.0答案之使用ldap作为本地用户认证方式

使用LDAP作为本地用户认证方式配置:用户信息和验证信息由不同程序提供。yum-yinstallsssdauthconfig-gtkkrb5-workstation(若不用kerberos验证则不用装)authconfig-gtk图形界面ldapuser0:password由ldap提供ldapuser0=kerberos由kerberos提供认证若是kerberos认... 查看详情

题库--阿里云云计算助理工程师aca认证考试--题库

1.阿里云大学>阿里云云计算助理工程师(ACA)认证-模拟考试https://edu.aliyun.com/clouder/exam/detail/1425423以下为💯答案2.另一篇文章总结也不错,题目截屏如下https://www.pianshen.com/article/78891539523/ 查看详情

关于红帽认证

...t认证是由服务器系统领域著名的厂商--Redhat公司推出的。红帽认证分为三个层次,初级的RHCT(红帽官方在2011年1月1号,取消RHCT的考试,改为RHCSA),中级的RHCE,高级的RHCA。另外在2005年,红帽又推出了一个新的安全领域的高级... 查看详情

华为hcie神秘大揭秘

...证书一样,企业或者用人单位在招聘的时候,会强制要求工程师具备某一项网络证书,比如HCIP证书或者HCIE证书华为认证的分类IP方向IT方向认证等级HCIA证书:华为认证初级网络工程师意味着企业有能力搭建基本的中小型网络,... 查看详情

参加51cto培训,红帽rhce认证考试通过啦

因为工作需求,从16年初开始学习linux。但是自学中遇到很多难点解决起来十分困难,学习进度十分缓慢。8月份为了跳槽,决定考RHCE认证,在网上找了很多培训机构,最终决定选择51CTO段超飞讲师。老司机果然不一样,思路清晰... 查看详情

软件架构

软件架构:四层操作系统:  RedHat红帽企业系统(RedHatEnterpriseLinux,RHEL)全球最大的开源技术厂商,提供性能极强的Linux套件系统并拥有完善的全球技术支持。  红帽公司推出的面向红帽Linux操作系统技能的认证考... 查看详情

2019年上半年网络工程师考试上午试题分析

2019年上半年网络工程师考试上午试题结构分析1.整体难度偏难:出现部分超纲题目。如位示图,有限自动机等与软件设计师的题目完全一样,对于网络工程师考试来说,确实比较难,不太可能网工的学员去学这些知识点。而且这... 查看详情

elastic认证考试团购报名第四季

...后,授予的徽章下方会有如上一段话:Elastic认证工程师拥有构建完整的Elasticsearch解决方案的技能。包含:包括部署、配置和管理Elasticsearch集群;将数据索引到这些集群中以及查询和分析索引数据的能力。为了获... 查看详情

elastic认证考试团购报名第三季

...后,授予的徽章下方会有如上一段话:Elastic认证工程师拥有构建完整的Elasticsearch解决方案的技能。包含:包括部署、配置和管理Elasticsearch集群;将数据索引到这些集群中以及查询和分析索引数据的能力。为了获... 查看详情

网络工程师考试的题型是怎样的?题量多少?有几科考试?

网络工程师分为上下午考试,题型以及题量如下。上午:计算机与网络基础知识,考试时间为150分钟,笔试,选择题;下午:网络系统设计与管理,考试时间为150分钟,笔试,问答题。每科满分75分,上午科目与下午科目均大于... 查看详情

国产化操作系统都有哪些认证可以考?

...。红帽认证主要包括"红帽认证管理员(RHCSA)"、"红帽认证工程师(RHCE)"与"红帽认证架构师(RHCA)"。参考技术A国产操作系统是以Linux为基础二次开发的操作系统。国内暂时还没有独立开发系统。 参考技术B就知道一个华为的网络工程的... 查看详情