红帽RHCSA及RHCE认证练习题及操作步骤

水平有限,做题仓促,如有错误遗漏,请谅解。

CHSCA

题外:

1.开机更改密码

Esc

e

[进入1模式] enter 

b[boot启动]

setenforce  0 {置于宽容模式修改密码}

passwd

reboot

2.service NetworkManager stop ; chkconfig NetworkManager off

3.service iptables stop ;chkconfig iptables off

 

#网络设置

Hostname: station.domainX0.example.com

IP:192.168.0.X

NETMASK:255.255.255.0

GATEWAY:192.168.0.254

 

1’ vim  /etc/sysconfig/network

2’vim  /etc/sysconfig/network-scripts/ifcfg-eth0

3’vim  /etc/resolv.conf  [ DNS]  

4’vim  /etc/hosts

#配置yum 源

指定到ftp://192.168.0.254/pub/rhel6/dvd/Server

1’cd  /etc/yum.repos.d/    若有其他,mv  dvd.repo  gls.repo  ../

2’vim   exam.repo[ 编辑yum源]

  [Server]

  name=Server

  baseurl=ftp://192.168.0.254/pub/rhel6/dvd/Server

  enable=1

  gpgcheck=0

3’yum list  {yum clean all 清除缓存}

#lvm 扩容

Will “/home  lv”  extend to 300 M (no more than 30 M error)

 

1’lvdisplay

2’lvextend  -L 300M /dev/vol0/home[ 要扩容的目标路径]

3’resize2fs  /dev/vol0/home

4’lvdisplay

#lvm缩容  reduce  to  200M

   1’lvdisplay

   2’umount  /home

   3’fsck  -f  /dev/vol0/home

   4’resize2fs  /dev/vol0/home  200M

   5’lvreduce  -L 200M  /home/vol0/home

   6’mount /home                  

#组管理

Add a group named “admin”

 

1’groupadd  -g  2000  admin

2’grep  admin  /etc/group

 

#用户管理

Add user “tom”, ask its home directory is /home/tommy

Add user “mike”, ask its uid is 800, its affiliated groups is “admin “

Add user “selina”,can’t  land shell

Passwd :RedHat

1’useradd  -d  /home/tommy  tom

2’useradd  -u 800 –G admin mike                 usermod –aG admin  添加新组

3’useradd  -s /sbin/nologin selina

4’for  UNAME in tom mike

>do

>echo “redhat”| passwd  --stdin $UNAME

>done

 

#文件权限

Copy  file /etc/passwd to /var/tmp

owners is root ,  group  :admin,the members of admin can write in it

Others  without any access

 

1’cp  /etc/passwd  /var/tmp

2’chgrp  admin  passwd   & chown  root:admin  passwd

3’chmod  660  passwd

相关推荐