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
#目录权限
添加新组 Create directory /admin/sales /admin/devel /admin/training
/admin/sales owner is root ,group is admin ,all users in the directory can create documents, but the files and directorys you created automatic for group admin, the owner for founder itself, other users without any access.
/admin/devel owner is root ,group is root , all users in the directory can create documents, but can't delete other files created by the user.
/admin/training the owner is root ,group is root ,user root has all the limits of authority, other users without any access, except user alex can write and read in this directory.
1’mkdir /admin cd /admin 2’mkdir {sales, devel ,training}
3’chgrp sales ;chmod 2770 sales 4 ‘chmod 1777 devel / 5chmod 770 training
6’setfacl –m u:alex:rwx training/ {若要求对此目录下创建的文件适当权限,d:g:admin:rw training } 7’ll : getfacle training/
#内核升级
1’yum –y install lftp* 2’lftp 192.168.0.254 3’get kernel
4’rpm –ivh kernel*
5’vim /boot/grub/grub.conf & /etc/grub.conf
#LDAP
Join ldap domain , dc=example, dc = com ,server = instructor.example.com
Certificate from :ftp://192.168.0.254/pub/example-cd.crt To be able to use ldapuserX0 on your machine 1’system-config-authentication
2’
3’su – ldapuser1 4’exit
#NTP server
1’system-config-date
-m setfacl 2’ 添加 网络
#自动挂载 ldapuser1
machine.
/ldaphome/ldapuserX on the server automatic mount on the directory /ldaphome on your
1’ showmount –e 192.168.0.254 & getent passwd ldapuserX 2’vim /etc/auto.mater /ldaphome /etc/auto.misc 3’vim /etc/auto.misc
ldapuserX -fstype=nfs 192.168.0.254:/ldaphome/ldapuserX * -fstype=nfs 192.168.0.254:/ldaphome/&
4’mkdir /home/guests; cd /home/guests; ln –s –d /ldaphome/ldapuserX ldapuserX 5’ ’service autofs stop ,service autofs start; chkconfig autofs on 6’su – ldapuserX
#WEB
Download from the service ftp://192.168.0.254/pub/test/ exam.html Rename index.html ,put it in /var/www/html http://station.domainX0.example.com to visit
1’lftp 192.168.0.254 get exam.html 2’yum –y install httpd 3’cp exam.html /var/www/html/index.html 4’vim /etc/hosts [进行主机名解析]
5’service httpd start ; chkconfig httpd on 6’firefox:查看 #FTP
Realize anonymous download
1’ yum -y install vsftpd
2’service vsftpd start; chkconfig vsftpd on
3’ cd /var/ftp/; mkdir mmm/;cd pub/ ; touch file1 4’lftp 192.168.0.9 5’ get file1
#FIND
1’mkdir -p /root/find 2’find /home -user tom -exec cp -a {} [-a 保留原文件属性] 3’cd /root/find
/root/find \\;

