This is a note that I sit in the Practical Workshop class with MSIT121)
Lecturer: Assistant Prof. Dr. Arnon Rungsawang
Well, I have already test and review the content below. Any problems you have, please report direct to me @klainfo
$ setup
$ service network start
$ ifconfig eth0
$ nslookup www.ku.ac.th
$ cd /etc/yum.repos.d $ mv CentOS-Base.repo CentOS-Base.repo.save $ wget http://mirror1.ku.ac.th/yum-centos/4/CentOS-Base.repo $ yum update หรือ yum -y update
$ groupadd -g 500 staff
$ groupdel %groupname
$ useradd -g staff -md /home/klainfo klainfo $ passwd klainfo
$ usermod -d /home/%newdir -m %username
$ usermod -l %new %old
$ usermod -g %group %username
$ chage
$ userdel %username $ userdel -r %username # delete user and home directory
root:x:0:0:root:/root:/bin/bash # LoginName:x:UserID:GroupID:UesrInfo:HomeDir:DefaultShell
root:x:0: # GroupName:x:GroupID:UserList # Example staff:x:1000:klainfo,pamon
$ df
$ vi /etc/fstab
$ umount /home; mount /home;
$ quotacheck -aug
$ repquota -aug
$ setquota -u %username %softlimit %hardlimit 0 0 %targetfs เช่น $ setquota -u kla 50000 70000 0 0 /home $ edquota -u %username
Disk quotas for user kla (uid 500): Filesystem blocks soft hard inodes soft hard /dev/sda3 8 0 0 4 0 0
$ setquota -g %groupname %softlimit %hardlimit 0 0 %targetfs เช่น $ setquota -g staff 50000000 70000000 0 0 /home $ edquota -g %groupname
$ quotaon -avugfp หรือ # quotaon -a
$ dd if=/dev/zero of=%filename bs=1024 count=%amount เช่น bs = 1024 bytes, count = 1000, It's 1MBytes. $ dd if=/dev/zero of=/home/klainfo/test bs=1024 count=1000
ตรวจสอบ
$ runlevel
เปลี่ยนไปที่ Level 3
$ init 3
Create or edit your crontab file
$ crontab -e
Display your crontab
$ crontab -l
Remove your crontab
$ crontab -r
| min | hour | day of month(1-31) | month | day of week(0-6) | command | comment |
|---|---|---|---|---|---|---|
| * | * | * | * | * | %command | # run ทุกๆ 1 วินาที |
| 30 | 0 | 1 | 1,6,12 | * | %command | # run ทุกๆ 00:30 Hr on 1st of Jan, June & Dec |
| 0 | 20 | * | 10 | 1-5 | %command | # run ทุกๆ 8:00PM every weekday(Mon-Fri) only in Oct. |
| 0 | 0 | 1,10,15 | * | * | %command | # run midnight on 1st, 10th & 15th of month |
| 5,10 | 0 | 10 | * | 1 | %command | # run at 12:05 and 12:10 every Monday and 10th of every month |
$ visudo -------------- # sudoers file. # # This file MUST be edited with the 'visudo' command as root. # # See the sudoers man page for the details on how to write a sudoers file. # # Host alias specification Host_Alias MASTER = localhost # User alias specification User_Alias ADMINS = kla # Cmnd alias specification Cmnd_Alias POWER = /sbin/poweroff Cmnd_Alias IPTABLES = /sbin/iptables -L # Defaults specification # User privilege specification root ALL=(ALL) ALL staff ALL=(ALL) ALL # Uncomment to allow people in group wheel to run all commands # %wheel ALL=(ALL) ALL # Same thing without a password # %wheel ALL=(ALL) NOPASSWD: ALL # Samples # %users ALL=/sbin/mount /cdrom,/sbin/umount /cdrom # %users localhost=/sbin/shutdown -h now kla localhost=IPTABLES
Open file
$ vi /etc/ssh/sshd_config
Uncommented
PermitRootLogin yes
Restart service
$ service sshd restart