사실 공부한 시간에 비해 문제가 쉽게나와 억울했다...
RHCSA 준비내용
명령어 정리
@at
# echo "dat > ~/myjob" | at now +1min
# atq
1 Thu May 19 14:47:00 2016 a root
2 Thu May 19 14:47:00 2016 a root
# atrm
@@crontab
# cat /etc/crontab //자세한 설명이 참조
/etc/cron.{hourly, daily, mothly, weekly}
생성하고 나서 (/etc/cron.daily/test)수정하고 나서는 꼭
# chmod +x /etc/cron.daily/test
@ systemd-tmpfiles
# systemd-tmpfiles --clean [conffilename].conf
# systemd-tmpfiles --create [conffilename].conf
@@ nice
# top // 프로세스별 nice 값 확인
# nice -n 10 [command &]
# renice -n -7 [command &]
단 음수는 root만 가능
@@@ ACL
# chmod g+s /shares/cases //하위에 파일, 폴더 생성시 그룹 동일 적용
# getfacl File
# setfacl -m u:james:rwx
# setfacl -m g:sodor:r-x
# setfacl -Rm u:student:rwX //모든 디렉토리 동시 적용
# setfacl -m d:u:USER:MOD DIRECTORY
# setfacl -k name
@@ SELinux
# getenforce
# setenforce {1|0}
# vim /etc/selinux/config
@# semanage fcontext -a -t httpd_sys_content_t '/custom(/.*)?'
@# restorecon -Rv /custom
# getsebool -a
# setsebool [boolname] {on|off}
# setsebool -P [boolname] {on|off} // 영구적 적용
# semanage boolean -l // 영구적인지 여부 확인법
# yum install setroubleshoot-server
@@ldap 서버
# yum -y install sssd authconfig-gtk krb5-workstation
# system-config-authentication
# getent passwd ldapuser3
ldapuser3:*:1703:1703:LDAP Test User 3:/home/guests/ldapuser3:/bin/bash
# ssh ldapuser3@localhost
ldapuser3@localhost's password:
Creating home directory for ldapuser3.
[ldapuser3@desktop3 ~]$ pwd
/home/guests/ldapuser3
[ldapuser3@desktop3 ~]$ ls -a
. .. .bash_logout .bash_profile .bashrc .cache .config .mozilla
[ldapuser3@desktop3 ~]$ logout
@@ipa 서버
# yum install -y ipa-client
# ipa-client-install --domain=server3.example.com --mkhomedir --no-ntp
# ssh ipauser@desktop3
ipauser@desktop3's password: password
Password expired. Change your password now.
Last login: Thu May 19 14:25:07 2016 from server3.example.com
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for user ipauser.
Current Password: password
New password: redhat123
Retype new password: redhat123
passwd: all authentication tokens updated successfully.
Connection to desktop3 closed.
@add disk, partition, file system
# fdisk - MBR
# gdisk - GPT
# partprobe
# mkfs.[filesystem] /dev/vdb[1-9]
# mount /dev/vdb[1-9] /mnt
# vim /etc/fstab
/dev/vdb1 /mnt xfs defaults 0 0
# {fdisk|gdisk}
# partprobe
# mkswap /dev/vdb2 /dev/vdb3
# swapon /dev/vdb2 /dev/vdb3
# free //confirm
# swapon -s //confirm priority
# vim etc/fstab
...
/dev/vdb2 swap swap defaults 0 0
/dev/vdb3 swap swap pri=-1 0 0
@LVM
CREATE
# pvcreate /dev/vdb1 /dev/vdb2
# vgcreate [vgname] -s 8M /dev/vdb1 /dev/vdb2
# lvcreate -n [lvname] -l [num] -L 5G vgname
# mkfs.[type] /dev/vgname/lvname
# mkdir /mountpoint
# mount -t xfs /dev/vgname/lvname /mountpoint
VG EXTEND
# fdisk /dev/vdb
# pvcreate /dev/vdb3
# vgextend vgname /dev/vdb3
VG REDUCE
# pvmove /dev/vdb2
# vgreduce vgname /dev/vdb2
LV EXTEND
# lvextend -l [num] -L [num][MG] /dev/vgname/lvname -r
@NFS
@SMB
# yum -y install cifs-utils
# mkdir ~/work
# mkdir /secure
# vim /secure/cred
username=student
password=student
domain=MYGROUP
# chmod 770 /secure
# chmod 600 /secure/cred
# vim /etc/fstab
//serverX/student /home/student/work cifs credentials=/secure/cred 0 0
@@@@Booting control
# systemctl isolate multi-user.target
# systemctl isolate graphical.target
# systemctl get-default
# systemctl set-default {grapical|multi-user}.target
ROOTPASSWORD
rd.break
# mount -o remount,rw /sysroot
# chroot /sysroot
# passwd
# touch /.autorelabel
# exit
# exit
/etc/fstabe
systemd.unit=emergency.target
# mount
# mount -o remount,rw /
# mount -a
# vim /etc/fstab
# mount -a
성과 체크 리스트)
1. LDAP
#yum install -y krb5-workstation sssd authconfig-gtk
#authconfig-gtk <-- 창 띄운다
#getent passwd ladapusr# 로 확인
2. ipaclient
[root@desktop4 ~]# ipa-client-install --domain=server4.example.com --mkhomedir --no-ntp
Discovery was successful!
Hostname: desktop4.example.com
Realm: SERVER4.EXAMPLE.COM
DNS Domain: server4.example.com
IPA Server: server4.example.com
BaseDN: dc=server4,dc=example,dc=com
Continue to configure the system with these values? [no]: yes
User authorized to enroll computers: admin
Synchronizing time with KDC...
Unable to sync time with IPA NTP server, assuming the time is in sync. Please check that 123 UDP port is opened.
Password for admin@SERVER4.EXAMPLE.COM:redhat123
ssh ipauser@desktop
password 변경
3. autofs
#yum -y intall autofs
#vim /etc/auto.master.d/name.autofs
내용 : /home/guests /etc/auto.name
#vim /etc/auto.name
내용: * -rw,sync(기본으로넣어준다) 해당서버:경로/&
ex) classroom.example.com:/home/guests/&
#systemctl enable autofs
#systemctl start autofs
#ldapuser로 로그인
4.root password 분실
1.부팅화면에서 첫번째에서 e키로 들어와 linux16행에 끝에서 rd.break 후 컨트롤 x
2.mount |grep -w '/' 로 rw/ro값 확인
3.mount -o remount,rw /sysroot
4.chroot /sysroot -- chroot이동
5.password 변경
6.touch /.autorelabel 생성
7.exit 2번 누르면 자동 리부팅 됨 --- message :system size and speed of hard drives. #%
5. /etc/fstab 복구
1.부팅화면에서 두번째로 e키로 들어와 linux16행에 끝에서 systemd.unit=emergency.target 후 컨트롤 x
2.give root password : root password 입력
3.mount |grep -w '/' 로 rw/ro 값확인(ro로 되어있을거다)
4.mount -o remount,rw /
5.mount -a 하면 에러메시지 출력되는데 해당값을 /etc/fstab에서 수정
6.수정 후 mount -a 정상처리되면 리붓
6.SElinux
1.#firefox localhost/사이트 로 보면 출력 안됨
2.#cat /var/log/message |grep -i preventing 으로 보면 id값 출력
3.#sealert -l id값 보면 해당 컨텐츠 위치 나옴
4.#ls -dZ /var/web-content/lab-content/ /var/www/html/ <--안보이는 컨텐츠와 기본 저장되는 부분하고 content 비교하여 재설정해야 함
5.#semanage fcontext -a -t httpd_sys_content_t '/var/web-content(/.*)?'
6.#restorecon -R /var/web-content -- 적용
7.#ls -dZ /var/web-content/lab-content/ /var/www/html/ <--보면 컨텐츠 같아짐
8.#firefox localhost/사이트 출력 완료
7. nice (프로세스 우선순위)
1.top 으로 우선순위 확인
2.renice -n 해당숫자 PID
8.ACL
#chgrp -R 그룹명 디렉토리명 -> 디렉토리와 해당콘텐츠 를 해당 그룹에 속하게 함
#chmod g+s 디렉토리명 ->해당 디렉토리에 스티키비트 추가하여 추가된 새파일들이 위에 속한 그룹에 들어가도록
#chmod 660 디렉토리명/* -> 디렉토리안 전부 660 주기
#setfacl -Rm g:그룹명:권한 /디렉토리 -> 재귀옵션을 사용하여 그룹명에 속한 멤버가 파일에 대해 액세스 권한갖고 디렉토리에서(해당콘텐츠 포함) 실행할 수 있는 ACL
#setfacl -Rm u:유저명:권한 /디렉토리 -> 유저에 파일,디렉토리 대한 권한 제한
# setfacl -m d:g:scotlandyard:rwx /shares/cases/ --- 이해 안됨... 기본으로 넣어줄때 재귀 빼주고 x도 소문자
# setfacl -m d:u:jones:rx /shares/cases/
곰곰히 생각해보니 이 자료만으로 충분한것같다.
과하다 싶을 정도이니 참고

댓글목록
등록된 댓글이 없습니다.