1 / 42

Solaris 10

Solaris 10. Users and Groups Management. User and Group. User คือ ผู้ใช้งาน Group คือ กลุ่มที่ใช้แบ่งแยกประเภทผู้ใช้งานตามลักษณะการทำงาน. User. ข้อมูลของทุก user จะถูกระบุไว้ที่ ไฟล์ /etc/passwd สามารถดูได้โดยใช้คำสั่ง more /etc/passwd. #more /etc/passwd

tovi
Download Presentation

Solaris 10

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Solaris 10

  2. Users and Groups Management

  3. User and Group • User คือ ผู้ใช้งาน • Group คือ กลุ่มที่ใช้แบ่งแยกประเภทผู้ใช้งานตามลักษณะการทำงาน

  4. User • ข้อมูลของทุก user จะถูกระบุไว้ที่ ไฟล์ /etc/passwd • สามารถดูได้โดยใช้คำสั่ง more /etc/passwd #more /etc/passwd root:x:0:0:Super-User:/:/sbin/sh daemon:x:1:1::/: bin:x:2:2::/usr/bin: sys:x:3:3::/: adm:x:4:4:Admin:/var/adm: lp:x:71:8:Line Printer Admin:/usr/spool/lp: uucp:x:5:5:uucp Admin:/usr/lib/uucp: …

  5. การเพิ่ม user • useradd login_name • login_name คือ ชื่อผู้ใช้ที่ต้องการสร้าง #useradd user1 #grep user1 /etc/passwd user1:x:1001:1::/home/user1:/bin/sh

  6. กำหนด passwordให้ user • passwd login_name #passwd –r files user1 New Password: Re-enter new Password: Passwd: password successfully changed for user1

  7. การยกเลิก user แบบชั่วคราว • passwd –l login_name • หลังจากยกเลิกแล้ว ถ้าต้องการใช้ user นี้อีกให้ใช้คำสั่ง passwd เพื่อกำหนด password ใหม่ให้ user #passwd –l user1 passwd: password information changed for user1

  8. การลบ user แบบถาวร • userdel login_name #userdel user1 #grep user1 /etc/passwd #

  9. Group • ข้อมูลของทุก group จะถูกเก็บไว้ที่ไฟล์ /etc/group • สามารถดูได้โดยใช้คำสั่ง more /etc/group #more /etc/group root::0: other::1:root bin::2:root,daemon sys::3:root,bin,adm adm::4:root,daemon uucp::5:root mail::6:root …

  10. การเพิ่ม group • groupadd group_name #groupadd group1 #grep group1 /etc/group group1::1001:

  11. การลบ group • groupdel group_name #groupdel group1 #grep group1 /etc/group #

  12. การเปลี่ยน group ให้ user • usermod –g group_namelogin_name • user ใหม่ จะถูกจัดให้มี group เป็น other #grep group1 /etc/group group1::1001: #usermod –g group1 user1 #grep user1 /etc/passwd user1:x:1001:1001::/home/user1:/bin/sh

  13. การลบ group ให้ user • ไม่มีคำสั่งเฉพาะ • ลบโดยการแก้ไขไฟล์ /etc/group

  14. การดู user และ group ปัจจุบัน • id #id uid=1001(user1) gid=1001(group1)

  15. File and Directory Management

  16. การดูรายชื่อ file และ directory • ls #cd / #ls Desktop export noautoshutdown users Documents home opt usr bin kernel platform var cdrom lib proc vol dev lost+found sbin workspace devices mnt system etc net tmp #

  17. การดูรายละเอียด file และ directory • ls –l #ls -l total 606 drwxr-xr-x 4 root root 512 Mar 20 2007 Desktop drwxr-xr-x 2 root root 512 Mar 20 2007 Documents lrwxrwxrwx 1 root root 9 Oct 10 2006 bin -> ./usr/bin drwxr-xr-x 3 root root 512 Jun 10 15:37 cdrom drwxr-xr-x 248 root sys 4096 Apr 23 2007 dev drwxr-xr-x 2 root sys 512 Jun 10 15:36 devices drwxr-xr-x 85 root sys 4608 Jun 10 19:18 etc …

  18. รายละเอียดของ ls -l • ระดับการเข้าถึงไฟล์ • ดัชนีของไฟล์ • user_name ของเจ้าของไฟล์ • group_name ของเจ้าของไฟล์ • ขนาดของไฟล์ • เวลาแก้ไขครั้งล่าสุด • ชื่อไฟล์ -rw-rw-r-- 1 user1 group1 0 Jun 11 12:55 test.txt

  19. ระดับการเข้าถึง file -rw-r--r-- 1 ประเภทของไฟล์ ( - = file, d = directory, l = link) 2-4 ความสามารถของเจ้าของในการ อ่าน เขียน รัน ตามลำดับ 5-7 ความสามารถของ group ในการ อ่าน เขียน รัน ตามลำดับ 8-10 ความสามารถของ user ทั่วไป ในการอ่าน เขียน รัน ตามลำดับ

  20. การแก้ไขระดับการเข้าถึงไฟล์การแก้ไขระดับการเข้าถึงไฟล์ • chmod permission_levelfile_name #ls –l test.txt -rw-r--r-- 1 user1 group1 0 Jun 11 12.55 test.txt #chmod g+w test.txt; ls -l -rw-rw-r-- 1 user1 group1 0 Jun 11 12:55 test.txt #chmod o+wx test.txt; ls –l -rw-rw-rwx 1 user1 group1 0 Jun 11 12:55 test.txt #chmod o-w test.txt; ls –l -rw-rw-rw- 1 user1 group1 0 Jun 11 12:55 test.txt

  21. การ copy file • cp source_filedestination_file • cp source_filedestination_directory #touch test.txt #ls test.txt #cp test.txt copied_file.txt #ls test.txt copied_file.txt

  22. การย้ายไฟล์ • mv source_filedestination_file • mv source_filedestination_directory #mkdir dir1 #mv test.txt dir1 #ls dir1 test.txt

  23. การลบไฟล์ • rm file_name • rm –rdirectory_name #ls test.txt #rm test.txt #ls #

  24. Process Management

  25. Process • Process คือ งาน หรือโปรแกรมต่างๆ ที่ทำงานอยู่ในระบบ

  26. การแสดง process ที่ทำงานอยู่ • ps • แสดง process ของ user ปัจจุบันที่ทำงานอยู่ในขณะนั้น #ps PID TTY TIME CMD 1303 pts/3 0:00 sh 1348 pts/3 0:00 ps

  27. การแสดง process ที่ทำงานอยู่ • ps –ef • แสดง process ทั้งหมดที่ทำงานอยู่ในขณะนั้น #ps –ef UID PID PPID C STIME TTY TIME CMD root 0 0 0 11:24:06 ? 0:10 sched root 1 0 0 11:24:06 ? 0:00 /sbin/init root 2 0 0 11:24:06 ? 0:00 pageout root 3 0 0 11:24:06 ? 0:13 fsflush …

  28. ตัวอย่างผลลัพธ์จาก ps -ef UID PID PPID C STIME TTY TIME CMD root 0 0 0 12:18:38 ? 0:09 sched root 1 0 0 12:18:38 ? 0:00 /sbin/init root 2 0 0 12:18:38 ? 0:00 pageout • UID : user id • PID : process id • PPID : parent process id • C : processor utilization • STIME : start time • TTY : terminal • TIME : cpu time • CMD : command

  29. การตรวจสอบ process ที่สนใจ • ps –ef | grep process_name #ps –ef|grep inetd root 223 1 0 11:24:31 ? 0:01 /usr/lib/inetd user1 1349 1303 0 13:38:55 pts/3 0:00 grep inetd

  30. การหยุด process • pkill -9 process_name

  31. Monitor Server • vmstat

  32. Virtual Directory for Web Application

  33. Shell Script

  34. Startup - Shutdown

  35. การ shutdown • shutdown -y -i5 -g0 • init 5 • poweroff

  36. การ restart • shutdown -y -i6 -g0 • init 6 • reboot

  37. Backup and Recovery

  38. การรวมไฟล์ • tar cvf tar_file_namefile_name • tar cvf tar_file_namedirectory #ls test.txt test2.txt #tar cvf test.tar test.txt test2.txt #ls test.txt test2.txt test.tar

  39. การบีบอัดไฟล์ • gzip file_name #ls test.tar #gzip test.tar #ls test.tar.gz

  40. การแตกไฟล์ที่บีบอัด • gunzip file_name #ls test.tar.gz #gunzip test.tar.gz #ls test.tar

  41. การดูขนาดไฟล์ก่อน backup • ufsdump S file_to_dump #id uid=1001(user1) gid=1001(group1)

  42. การ backup file • ufsdump

More Related