Professional Documents
Culture Documents
ชื่อ
ชัน้ ป.ตรี 2 วิศวกรรม
คอมพิวเตอร์
ขัน
้ ตอนปฏิบัติ
1. สร้าง กลุ่มผ้้ใช้ขึ้นมา 2 กลุ่ม ได้แกุ GID=1000 (teacher) และ
GID=2000 (student)
2. สร้างผ้้ใช้ขึ้นมา 2 คนได้แกุ teacher (UID=1001) และ userxxx
(UID=2001, โดยที่ xxx รหัส 3 ตัวท้าย)
โดยที Home directory เหมือนชื่อ login และอยุ้ภายใต้ /export/home
3. ตัง้ password ของทัง้ คุ้เป็ น abcd1234
4. จากนั ้น logout และให้ login ด้วย teacher และให้สร้าง directory ขึ้นใหมุ
3 dir. และแตุละ directory มี
3 ไฟล์เปลุา โดยมีการตัง้ ชื่อเหมือนกับ ชื่อ login แตุมีตัวเลขตุอท้าย
5. ทำาการเรียกใช้คำาสัง่ su และทำาการเปลี่ยน group และ owner ของ
directory ที่ 3 ให้เป็ นของ (student) และ userxxx
6. จากนั ้นทำาการย้ายเฉพาะ directory ที่ 3 ไปที่ home directory ของ
userxxx
7. ทำาการ copy directory /sbin ทัง้ หมดมาเก็บไว้ท่ี directory ปั จจ่บัน
8. ทำาการ tar ไฟล์และ directory ทัง้ หมดใน directory ปั จจ่บัน ให้มีช่ ือวุา
userxxx.tar
9. จากนั ้นให้ทำาการ zip ไฟล์ tar ข้างต้น และทำาการ copy ไปยัง home
directory ของ userxxx
10. ออกจาก su จากนั ้นให้ logout และให้ login เป็ น userxxx
11. ตอนนี ้ อยุ้ท่ี home directory ของ userxxx แล้ว จากนั ้นให้ทำาการ แตก
zip และทำาการ แตกไฟล์ tar ด้วย
12. ทำาการ Telnet ไปที่ localhost
13. Logon on ด้วย User: userxxx
14. พิมพ์คำาสัง
่
#who am I
และทำาคำาสัง่ ตุอไปนี้พร้อมกับเก็บผลลัพธ์หน้ าจอและคำาอธิบาย
Execute commands in background
Usually, the shell remains inactive during command execution. Another command cannot be
executed until the previous command has completed and the shell displays another command
prompt. This is referred to as foreground execution. Altenatively, commands can be
executed in background. While a program runs in background, the shell is immediately
available to execute another command.
ls -al /etc
ps
pwd
ls -al /etc&
ps
pwd
sleep 600
Ctrl-z
bg
jobs
ps
fg
Ctrl-z
bg
นายธนิ ต เกต่แก้ว
แผนกวิชาเทคนิ คคอมพิวเตอร์
มหาวิทยาลัยเทคโนโลยีราชมงคลล้านนา
ผลการทดลอง
1. สร้าง กลุ่มผ้้ใช้ขึ้นมา 2 กลุ่ม ได้แกุ GID=1000 (teacher) และ
GID=2000 (student) โดยการใช้คำาสัง่
#groupadd -g 1000 teacher โดย 1000 คือ group id และ teacher
คือชื่อของกลุ่ม ทำำคำำสัง่ ในรูปแบบนี้ เชุนเดียวกัลป์ กลุ่มของ student คือ
#group –g 2000 student
จำกนั้ นจึงลองตรวจสอบดูวุำมีกลุ่มที่สร้ำงขึ้นหรือไมุจำกคำำสัง่
#more /etc/group
จะเห็นชื่อกลุ่ม teacher และ student อยุูข้ำงลุำงส่ด
8. ทำาการ tar ไฟล์และ directory ทัง้ หมดใน directory ปั จจ่บัน ให้มีช่ ือวุา
userxxx.tar
ใช้คำำสัง่ tar –cvf user025.tar ซึ่ง –cvf หมำยถึงกำรนำำไฟล์(creat)
ใน dir ปั จจ่บันมำทำำเป็ น tar
9. จากนั ้นให้ทำาการ zip ไฟล์ tar ข้างต้น และทำาการ copy ไปยัง home
directory ของ userxxx
ให้ใช้คำำสัง่ gzip มนกำรทำำเป็ น zip โดยไฟล์ท่ีได้จะเป็ น .gz
คำำสัง่ คือ #gzip user025.tar
จำกนั้ นก็จะได้ไฟล์ user025.tar.gz ซึ่งผุำนกำร zip เป็ นที่เรียบร้อย
ตุอมำก็ทำำกำรแตกไฟล์ tar
ใช้คำำสัง่ $tar –xvf user025.tar
-x หมำยถึง excute เป็ นกำรแตกไฟล์จำก tar นั ่นเอง
เมื่อทำำกำรแตกไฟล์เสร็จก็จะได้ dir. Sbin teacher1 teacher2 เพิ่มขึ้นมำ