两台虚拟机,请认准机器再做。
本域是domainX.example.com,172.25.X.0/24;敌对域my133t.org,172.26.X.0/24
考试准备工作:
一次性放开本域的所有访问
firewall-cmd --permanent --list-all
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=172.25.X.0/24 accept'
firewall-cmd --reload
如遇到阻止需求,明确reject即可。
收尾工作:
server:
systemctl enable postfix nfs-server nfs-secure-server smb nmb httpd target mariadb firewalld NetworkManager
desktop:
systemctl enable nfs-secure iscsi iscsid postfix firewalld NetworkManager
1. 配置 SELinux
SELinux 必须在两个系统server 和 desktop中运行于 Enforcing 模式
[root@server ~]# setenforce 1
[root@server ~]# vim /etc/selinux/config
SELINUX=enforcing
2. 配置SSH访问
按以下要求配置SSH访问:
用户能够从域 domainX.example.com 内的客户端通过SSH远程访问您的两个虚拟机系统
在域 my133t.org 内的客户端不能访问您的两个虚拟机系统
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=172.25.X.0/24 service name="ssh" accept'
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=172.26.X.0/24 service name="ssh" reject'
firewall-cmd --reload
在两个虚机都做
3. 自定义用户环境
在系统 server 和 desktop上创建自定义命令名为 qstat 此自定义命令将执行以下命令:
/bin/ps -Ao pid,tt,user,fname,rsz
此命令对系统中所有用户有效。
vim /etc/bashrc
末尾加 alias qstat='/bin/ps -Ao pid,tt,user,fname,rsz'
在两个虚机都做
4. 配置端口转发
在系统 server 配置端口转发, 要求如下:
在 172.25.X.0/24 网络中的系统, 访问 server 的本地端口 5423 将被转发到80
此设置必须永久有效
firewall-config添加富规则
或者
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=172.25.X.0/24 forward-port port=5423 protocol=tcp to-port=80'
firewall-cmd --reload
5. 配置聚合链路
*************************开始练习前先运行,预备环境(考试时无需做这个)
练习准备在server做lab teambridge setup ,在desktop 做lab teamdesk setup
*************************
在 server.domainX.example.com 和 desktop.domainX.example.com 之间按以下要求配置一个链路:
此链路使用接口 eno1 和 eno2
此链路在一个接口失效时仍然能工作
此链路在 server 使用下面的地址 172.16.X.25/255.255.255.0
此链路在 desktop 使用下面的地址 172.16.X.35/255.255.255.0
此链路在系统重启之后依然保持正常状态
[root@server ~]# nmcli connection add type team con-name team0 ifname team0 config '{"runner":{"name":"activebackup"}}'
[root@server ~]# nmcli connection modify team0 ipv4.method manual ipv4.addresses '172.16.12.25/24'
[root@server ~]# nmcli connection add type team-slave con-name team0-port1 ifname eno1 master team0
[root@server ~]# nmcli connection add type team-slave con-name team0-port2 ifname eno2 master team0
验证:
[root@server ~]# teamdctl team0 state
[root@server ~]# nmcli dev dis eno1
[root@server ~]# teamdctl team0 state
[root@server ~]# nmcli con up team0-port1
[root@server ~]# teamdctl team0 state
firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=172.16.X.0/24 accept'
在desktop上相同操作
6. 配置IPv6地址
在您的考试系统上配置接口 eth0 使用下列IPv6地址:
server 上的地址应该是 200e:ac18::e0a/64
desktop 上的地址应该是 200e:ac18::e14/64
两个系统必须能与网络 200e:ac18/64 内的系统通信。
地址必须在重启后依旧生效。
两个系统必须保持当前的IPv4地址并能通信。
nm-connection-editor
或者
nmcli con mod "System eth0" ipv6.method manual ipv6.address '200e:ac18::e0a/64'
nmcli con down "System eth0" && nmcli con up "System eth0"
两台都做
7. 配置本地邮件服务
在系统server 和 desktop 上 配置邮件服务,满足以下要求:
这些系统不接收外部发送来的邮件
在这些系统上本地发送的任何邮件都会自动路由到 classroom.example.com
从这些系统上发送的邮件显示来自于 domainX.example.com
您可以通过发送邮件到本地用户 'dave' 来测试您的配置, 系统 classroom.example.com 已经配置把此用户的邮件转到下列URL http://classroom.example.com/received_mail/X
[root@server ~]# postconf -e "relayhost= classroom.example.com"
#[root@server ~]# postconf -e "inet_interfaces=loopback-only"
[root@server ~]# postconf -e "mynetworks=127.0.0.0/8 [::1]/128"
[root@server ~]# postconf -e "myorigin= domainX.example.com"
[root@server ~]# postconf -e "mydestination="
#[root@server ~]# postconf -e "local_transport=error: local delivery disabled"
[root@server ~]# systemctl restart postfix
[root@server ~]# systemctl enable postfix
两台都做
#################################################################
8---12题练习环境和验证采用p239的实验,对比本文中相关参数的变化
#################################################################
8. 通过 SMB 共享目录
在server上配置SMB服务
您的 SMB 服务器必须是 STAFF 工作组的一个成员
共享 /common 目录 共享名必须为 common
只有 domainX.example.com 域内的客户端可以访问 common 共享
common 必须是可以浏览的
用户 andy 必须能够读取共享中的内容,如果需要的话,验证的密码是 sestiver
[root@server ~]# yum install -y samba samba-client
[root@server ~]# vim /etc/samba/smb.conf
workgroup = STAFF
hosts deny = 172.26.X.0/24
hosts allow = 172.25.X.0/24 127.0.0.0/8
[common]
path = /common
printable = no
browseable = yes
read list = andy
[root@server ~]# mkdir /common
[root@server ~]# chcon -R -t samba_share_t /common
或者semanage fcontext -a -t samba_share_t '/common(/.*)?'
restorecon -vRF /common
[root@server ~]# smbpasswd –a andy 密码是sestiver
[root@server ~]# pdbedit -L
[root@server ~]# systemctl restart smb nmb
[root@server ~]# systemctl enable smb nmb
[root@desktop ~]# yum insatall samba-client cifs-utils -y
[root@desktop ~]# smbclient -L //serverX
[root@desktop ~]# smbclient //serverX/common -U andy%sestiver
9. 配置多用户SMB 挂载
在server 共享通过SMB目录 /miscellaneous 满足以下要求:
共享名为 miscellaneous
共享目录 miscellaneous 只能被 domainX.example.com 域中的客户端使用
共享目录 miscellaneous 必须可以被浏览
用户 silene 必须能以读的方式访问此共享, 访问密码是 sestiver
用户 akira 必须能以读写的方式访问此共享, 访问密码是 sestiver
此共享永久挂载在 desktop.domainX.example.com 上的 /mnt/multi 目录, 并使用用户 silene 作为认证 任何用户可以通过用户 akira 来临时获取写的权限
[root@server ~]# mkdir /miscellaneous
[root@server ~]# chcon -R -t samba_share_t /miscellaneous
[root@server ~]# vim /etc/samba/smb.conf
[miscellaneous]
comment = Public Stuff
path = /miscellaneous
printable = no
browseable = yes
writable = no
write list = akira
read list = silene
[root@server ~]# systemctl restart smb;systemctl restart nmb
[root@server ~]# useradd silene akira
[root@server ~]# smbpasswd –a silene 密码是sestiver
[root@server ~]# smbpasswd –a akira 密码是sestiver
[root@server ~]# chmod o+w /miscellaneous
[root@server ~]# pdbedit -L
[root@server ~]# systemctl restart smb nmb
[root@desktop ~]# smbclient -L //serverX/common
[root@desktop ~]# smbclient -L //serverX/miscellaneous -U akira%sestiver
[root@desktop ~]# yum -y install cifs-utils samba-client
[root@desktop ~]# mkdir /mnt/muli
[root@desktop ~]# echo 'username=silene' >>/root/smb-multiuser.txt
[root@desktop ~]# echo 'password=sestiver' >>/root/smb-multiuser.txt
[root@desktop ~]# vim /etc/fstab
//serverX/miscellaneous /mnt/multi cifs credentials=/root/smb-multiuser.txt,multiuser,sec=ntlmssp 0 0
[root@desktop ~]# mount -a
验证:
[wode@desktop ~]# cifscreds add server -u silene
[wode@desktop ~]# touch /mnt/multi/aaa
[dewo@desktop ~]# cifscreds add server -u akira
[dewo@desktop ~]# touch /mnt/multi/aaa
[常见错误:找不到合适的地址。检查共享名、用户名、服务重启;还要注意samba_share_t]
11. 配置NFS服务
在 server 配置NFS服务,要求如下:
以只读的方式共享目录 /public 同时只能被 domainX.example.com 域中的系统访问
以读写的方式共享目录 /protected 能被 domainX.example.com 域中的系统访问
访问 /protected 需要通过Kerberos安全加密, 您可以使用下面URL提供的密钥 http://172.25.254.254/pub/keytabs/server12.keytab
目录 /protected 应该包含名为 confidential 拥有人为ldapuserX 的子目录
域用户 ldapuserX 能以读写方式访问 /protected/confidential
**************练习准备lab storageshares setup,server和desktop都需要做**************
[root@server ~]# mkdir /public
[root@server ~]# mkdir /protected/confidential
[root@server ~]# su - ldapuserX
[root@server ~]# chown ldapuserX /protected/confidential
[root@server ~]# wget -O /etc/krb5.keytab http://172.25.254.254/pub/keytabs/server12.keytab
[root@server ~]# vim /etc/sysconfig/nfs
RPCNFSDARGS="-V 4.2"
[root@server ~]# vim /etc/exports
[root@server ~]# echo "/public 172.25.X.0/24(ro)" >>/etc/exports
[root@server ~]# echo "/protected 172.25.X.0/24(sec=krb5p,rw)" >>/etc/exports
[root@server ~]# exportfs -r
[root@server ~]# systemctl restart nfs-server.service
[root@server ~]# systemctl enable nfs-secure-server.service
[root@server ~]# systemctl start nfs-secure-server.service
12. nfs客户端
开机自动挂载
public /mnt/nfsmount
protect /mnt/nfssecure
[root@desktop ~]# showmount -e serverX
[root@desktop ~]# yum -y install nfs-utils
[root@desktop ~]# wget -O /etc/krb5.keytab http://172.25.254.254/pub/keytabs/desktop12.keytab
[root@desktop ~]# mkdir –p /mnt/{nfssecure,nfsmount}
[root@desktop ~]# vim /etc/fstab
server:/public /mnt/nfsmount nfs defaults 0 0
server:/protect /mnt/nfssecure nfs defaults,v4.2,sec=krb5p 0 0
[root@desktop ~]# mount -a
[root@desktop ~]# systemctl enable nfs-secure
[root@desktop ~]# systemctl start nfs-secure
【常见错误禁止访问:身份验证失败,检查/etc/krb5.keytab、客户服务器反解全名、时差】
练习准备lab storageshares setup , server和desktop都需要做
*************************
########################################################################
13------17可并为一道题做,做一个conf文件,一次systemctl enable 和 start。
练习环境的主机名解析包括serverX.example.com(第一个站) 和wwwX.example.com(virtul)
########################################################################
nsloopup:serverX.example.com wwwX.example.com webappX.example.com
13 配置web站点
server 上配置一个站点 http://server.domainX.example.com 然后执行下述步骤:
从 http://classroom.example.com/pub/materials/station.html
下载文件,并且将文件重命名为 index.html 不要修改此文件的内容
将文件 index.html 拷贝到您的 web 服务器的 DocumentRoot 目录下
来自于 domainX.example.com 域的客户端可以访问此Web服务
来自于 my133t.org 域的客户端拒绝访问此Web服务
[root@server ~]# yum install httpd
浏览器:172.25.254.254/content/RHCE/web station.html
[root@server ~]# wget http://172.25.254.254/content/RHCE/web/station.html
[root@server ~]# cd /usr/share/doc/httpd-2.4.6/
[root@server ~]# cp httpd-vhosts.conf /etc/httpd/conf.d/.
[root@server ~]# cp station.html /var/www/html/index.html
[root@server ~]# vim /etc/httpd/conf.d/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/var/www/html"
ServerName serverX.example.com
</VirtualHost>
[root@server ~]# systemctl restart httpd.service
[root@server ~]# systemctl enable httpd.service
[root@server ~]# firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=172.26.X.0/24 service name="http" reject'
[root@server ~]# firewall-cmd --reload
14 配置安全web服务
为站点 http://server.domainX.example.com 配置TLS加密
一个已签名证书从 http://host.domainX.example.com/pub/materials/server.crt 获取
此证书的密钥从 http://host.domainX.example.com/pub/materials/server.key 获取
此证书的签名授权信息从 http://host.domainX.example.com/pub/materials/domainX.crt 获取
[root@server ~]# yum install -y mod_ssl
[root@server ~]# vim /etc/httpd/conf.d/ssl.conf
<VirtualHost *:443>
#
DocumentRoot "/var/www/html"
ServerName serverX.example.com:443
#
SSLCertificateFile /etc/pki/tls/certs/serverX.crt
SSLCertificateKeyFile /etc/pki/tls/private/serverX.key
#
</VirtualHost>
[root@server ~]# cd /etc/pki/tls/private
浏览器:http://172.25.254.254/pub/tls/private/serverX.key
[root@server ~]# wget http://172.25.254.254/pub/tls/private/server13.key
[root@server ~]# cd /etc/pki/tls/certs
浏览器:http://172.25.254.254/pub/tls/certs/server13.crt
[root@server ~]# wget http://172.25.254.254/pub/tls/certs/server13.crt
[root@server ~]# systemctl restart httpd
15 配置虚拟主机
在 server 上扩展您的 web 服务器,为站点 http://www.domainX.example.com创建一个虚拟主机,然后执行下述步骤:
设置 DocumentRoot 为 /var/www/virtual
从 http://classroom.example.com/pub/materials/www.html
下载文件并重命名为 index.html 不要对文件 index.html 的内容做任何修改
将文件 index.html 放到虚拟主机的 DocumentRoot 目录下
确保 andy 用户能够在 /var/www/virtual 目录下创建文件
注意:原始站点 http://server.domainX.example.com 必须仍然能够访问,
名称服务器 rhmgr.domainX.example.com 提供对主机名 www.domainX.example.com 的域名解析
[root@server ~]# cd /var/www
[root@server ~]# mkdir virtual
[root@server ~]# vim /etc/httpd/conf.d/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/var/www/virtual"
ServerName wwwX.example.com
</VirtualHost>
[root@server ~]# wget http://http://172.25.254.254/content/RHCE/web/www.html
[root@server ~]# cp www.html /var/www/virtual/index.html
[root@server ~]# setfacl –m u:andy:rwx /var/www/virtual
[root@server ~]# setfacl –m d:u:andy:rwx /var/www/virtual
另一种形式:
DocumentRoot目录只要不是/var/www目录下的子目录
例:DocumentRoot目录为:/virtual
则:
[root@server ~]# mkdir /virtual
[root@server ~]# vim /etc/httpd/conf.d/httpd-vhosts.conf
<VirtualHost *:80>
DocumentRoot "/virtual"
ServerName wwwX.example.com
</VirtualHost>
<Directory "/virtual">
AllowOverride None
Require all granted
</Directory>
[root@server13 www]# chcon -R -t httpd_sys_content_t /virtual/
注:ls -Z 和 ls -Zd 的区别:
[root@server13 ~]# ls -Zd /virtual/
drwxr-xr-x. root root unconfined_u:object_r:default_t:s0 /virtual/
[root@server13 ~]# ls -Z /virtual/
空
16 配置 web 内容的访问
在您的server 上的 web 服务器的 DocumentRoot 目录下 创建一个名为 secret 的目录,要求如下:
从 http://classroom.example.com/pub/materials/private.html 下载一个文件副本到这个目录,并且重命名为 index.html。
不要对这个文件的内容做任何修改。
从 server 上,任何人都可以浏览 secret 的内容, 但是从其它系统不能访问这个目录的内容
[root@server ~]# vim /etc/httpd/conf.d/httpd-vhosts.conf
<Directory "/var/www/html/secret">
Require local
Require all denied
</Directory>
<Directory "/var/www/virtual/secret">
Require local
Require all denied
</Directory>
浏览器:http://172.25.254.254/content/RHCE/web/secret1.html
http://172.25.254.254/content/RHCE/web/secret2.html
[root@server ~]# wget http://172.25.254.254/content/RHCE/web/secret1.html
[root@server ~]# wget http://172.25.254.254/content/RHCE/web/secret2.html
[root@server ~]# mkdir /var/www/html/secret
[root@server ~]# mkdir /var/www/virtual/secret
[root@server ~]# cp secret1.html /var/www/html/secret/index.html
[root@server ~]# cp secret2.html /var/www/virtual/secret/index.html
[root@server ~]# httpd -t (只检查配置文件是否有语法错误)
[root@server ~]# systemctl restart httpd
17 实现动态Web内容
在 server 上配置提供动态Web内容,要求如下:
动态内容由名为dynamic.domainX.example.com的虚拟主机提供 ###########教室练习请用webappX.example.com##########
虚拟主机侦听在端口 8998
从 http://classroom.example.com/pub/materials/webapp.wsgi 下载一个脚本,然后放在适当的位置, 无论如何不要求修改此文件的内容
客户端访问 http://dynamic.domainX.example.com:8998/ 时 应该接收到动态生成的web页面
此 http://webappX.example.com:8998/ 必须能被 domainX.example.com 域内的所有系统访问
[root@server ~]# yum install -y mod_wsgi
[root@server ~]# vim /etc/httpd/conf.d/httpd-vhosts.conf
Listen 8998
<VirtualHost *:8998>
DocumentRoot "/var/www/html"
ServerName webappX.example.com
WSGIScriptAlias / /var/www/html/webapp.wsgi
</VirtualHost>
[root@server ~]# cp webapp.wsgi /var/www/html
[root@server ~]# semanage port -a -t http_port_t -p tcp 8998
[root@server ~]# systemctl restart httpd
**************教室检验 elinks http://webappX.example.com:8998**********
18 shell编程
文件名/root/script
参数foo显示bar,参数bar显示foo,
没有参数或错误显示“/root/script foo|bar”错误信息
#!/bin/bash
#
case $# in
1)
if [ "$1" == "bar" ];then
echo "foo"
elif [ "$1" == "foo" ];then
echo "bar"
else
echo "/root/script foo|bar" >&2
fi
;;
*)
echo "/root/script foo|bar"
exit 2
;;
esac
================================
[root@server ~]# vim /root/script
#!/bin/sh
if [ "$#" -eq 1 ]
then
if [ "$1" == "bar" ]
then
echo "foo"
elif [ "$1" == "foo" ]
then
echo "bar"
else
echo "/root/script foo|bar" >&2
fi
else
echo "/root/script foo|bar" >&2
fi
# chmod a+x /root/script
19 创建一个添加用户的脚本
在server上创建一个脚本,名为/root/mkusers,此脚本能实现为server创建本地用户,并且这些用户的用户名来自一个包含用户名列表的文件。同时满足下列要求:
此脚本要求提供一个参数,此参数就是包含用户名列表的文件
如果没有提供参数,此脚本应该给出下面的提示信息Usage:/root/mkusers filename然后退出并返回相应的值。
如果提供一个不存在的文件名,此脚本应该给出下面的提示信息 Input file not found然后退出并返回相应的值
创建的用户登录shell是/bin/false
此脚本不需要为用户设置密码
您可以从下面的URL获取用户名列表作为测试用http://classroom.example.com/pub/materials/userlist
#!/bin/bash
#
case $# in
1)
if [ -e $1 ] && [ -f $1 ];then
for I in `cat $1`;do
useradd -s /bin/fales $I
done
else
echo "Input file not found" >&2
exit 2
fi
;;
*)
echo "Usage:/root/mkusers filename" >&2
exit 1
;;
esac
================================================
[root@server ~]# vim /root/mkusers
#!/bin/bash
if [ $# -ne 1 ]
then echo ‘Usage:/root/mkusers filename’ >&2
exit 1
elif [ -f $1 ]
then
for i in `cat $1`
do
useradd –s /bin/fales $i
done
else
echo ‘Input file not found’ >&2
exit 1
fi
[root@server ~]# chmod a+x /root/mkusers
20 配置iscsi服务器
配置server提供一个iscsi服务磁盘名为iqn.2014-09.com.example.domain0:server,并符合下列要求:
服务端口为3260
使用iscsi_vol作其后端卷,其大小为3G
此服务只能被desktop.domain0.example.com访问
需要先创建名字叫做iscsi_vol的逻辑卷。(分区至少3050M)
[root@server ~]# yum install -y targetcli
[root@server ~]# systemctl enable target.service
[root@server ~]# systemctl start target.service
[root@server ~]# targetcli
/backstores/block create server.disk1 /dev/vgname/iscsi_vol
/iscsi create iqn.2014-09.com.example.domain0:server
/iscsi/iqn.2014-09.com.example.domain0:server/tpg1/acls create iqn.2014-09.com.example.domain0:server:desktop
/iscis/iqn.2014-09.com.example.domain0:server/tpg1/luns create /backstorte/block/server.disk1
/iscis/iqn.2014-09.com.example.domain0:server/tpg1/portals create 172.25.X.11
saveconfig
exit
21 配置iscsi客户端
配置desktop使其能连接在server的上提供的iqn.2014-09.com.example.domain0:server并符合下列要求:
块设备iSCSI上包含一个大小为1700 MiB的分区,并格式化为xfs
此分区挂载在/mnt/data上同时在系统启动的期间自动挂载
[root@desktop ~]# yum install iscsi-initiator-utils
[root@desktop ~]# vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2014-06.com.example:desktop
[root@desktop ~]# iscsiadm -m discovery -t st -p serverX.example.com
[root@desktop ~]# iscsiadm -m node -T iqn.2014-09.com.example.domain0:server -p serverX.example.com -l
[root@desktop ~]# fdisk /dev/sda(分1.7G)
[root@desktop ~]# mkfs.xfs /dev/sda1
[root@desktop ~]# blkid /dev/sda
[root@desktop ~]# vim /etc/fstab
UUID=... /mnt/data xfs defaults,_netdev 0 0
(如需重启服务systemctl restart iscsid ;systemctl restart iscsi)
22.配置一个数据库
在server上创建一个MariaDB 数据库,名为了Contacts,并符合以下条件:
数据库应该包含来自数据库复制的内容,复制文件的URL为http://classroom.example.com/pub/materials/users.mdb
数据库只能被localhost访问
除了root用户,此数据库只能被Luigi查询。此用户密码为mishigs
root密码mishings,同时不允许空密码登录。
[root@server ~]# yum groupinstall mariadb -y
[root@server ~]# systemctl enable mariadb.service
[root@server ~]# systemctl start mariadb.service
[root@server ~]# vim /etc/my.cnf
[mysqld]段下加
skip-networking=1
[root@server ~]# mysql_secure_installation
密码:[回车]
设新密码:y
输两次密码
移除密码:y
禁止root远程:y
移除测试db:y
重加新配置:y
[root@server ~]# mysql -uroot -pmishings
[maridb]> create datebase Contacts;
[maridb]> exit
[root@server ~]# mysql -uroot -pmishings Contacts < users.mdb
create user luigi@localhost identified by 'luigi_password';
grant select on Contacts.* to luigi@localhost;
23.数据库中的数据查询,填空
“数据库中有三张表, User_Names User_Logins User_Contacts”
在密码表当中查出密码是forsook的用户叫什么名字
查出first name(看英文题)是Alan用户住址在Cupertino的用户个数
select User_Names.first_name from User_Names,User_Logins where User_Names.user_id=User_Logins.id and User_Logins.User_Pass="forsook";
或select user.name from user inner join infor on user.id=infor.id where infor.pass="tapacalaya";
select count(*) from User_Contacts,User_Names where User_Contacts.Location="Cupertino" and User_Names.first_name="Alan" and User_Contacts.id=User_Names.user_id;
或select count(*) from user inner join address on user.id=address.id where user.name="john" and address.addr="Washion";
//摘要
samba
===server
yum install samba -y
yum install samba-client -y
mkdir /common
mkdir /miscellaneous
chmod 777 /miscellaneous/
semanage fcontext -a -t samba_share_t '/common(/.*)?'
semanage fcontext -a -t samba_share_t '/miscellaneous(/.*)?'
restorecon -vRF /common/
restorecon -vRF /miscellaneous/
ll -Zd /common/
ll -Zd /miscellaneous/
clear
vim /etc/samba/smb.conf (编辑)
useradd andy
useradd akira
useradd silene
smbpasswd -a andy
smbpasswd -a akira
smbpasswd -a silene
pdbedit -L
systemctl restart smb nmb
systemctl enable smb nmb
===desktop
yum install cifs-utils
yum install samba-client
smbclient -L //172.25.12.11 -U akira%sestiver
mkdir /mnt/multi
echo "username=silene" >> /root/sam-pass.txt
echo "password=sestiver" >> /root/sam-pass.txt
vim /etc/fstab (编辑)
mount -a
df -h
userad wode
useradd wode
useradd dewo
su - wode (测试)
su - dewo (测试)
history
nfs(2mk-1ch-2peizhi-2sys)
===server
mkdir -pv /public
mkdir -pv /protected/confidential
lab storageshares setup
id ldapuser12
chown ldapuser12 /protected/confidential/
wget -O /etc/krb5.keytab http://172.25.254.254/pub/keytabs/server12.keytab
vim /etc/sysconfig/nfs (重要)
vim /etc/exports
systemctl restart nfs-server
systemctl enable nfs-server
systemctl enable nfs-sevure-server
systemctl restart nfs-secure-server
vim /etc/exports
exportfs -r
reboot
===desktop
yum install nfs-utils
lab storageshares setup
wget -O /etc/krb5.keytab http://172.25.254.254/pub/keytabs/desktop12.keytab
mkdir /mnt/nfsmount
mkdir /mnt/nfssecure
vim /etc/fstab
showmount -e 172.25.12.11 >> /etc/fstab (编辑)
mount -a
systemctl restart nfs-secure(重要)
systemctl enable nfs-secure
mount -a
df -h
su - ldapuser12
history
备份地址: 【RHCE-EXERCISE】