GIÁO TRÌNH UNIX - Trang 18

Copyright(c) by Galaxy CD – http://www.galaxycd.com

17

$

>

titi

$

ll

titi

-rw-------

1

user1 other 0

Mar 11

10:11 titi

$

umask

333

$

>toto

$

ll

toto

-r--r--r--

1

user1 other 0

Mar 11

20:11 toto

3.3.5 Thay ñoåi ngöôøi hoaëc nhoùm sôû höõu file:
Leänh

chown

cho pheùp thay ñoåi ngöôøi sôû höõu.

Leänh

chgrp

cho pheùp thay ñoåi nhoùm sôû höõu.

$

echo Hello >file1

$

chmod 700 file1

$

ls -l file1

-rwx------

1

user1 stagiair

6

Apr

5

14:06 file1

$

cat file1

Hello


$

chgrp animator file1

$

ls -l file1

-rwx------

1

user1 animator

6

Apr

5

14:06 file1

$

chown user2 file1

$

ls -l file1

-rwx------

1

user2 animator

6

Apr

5

14:06 file1


$

cat file1

cat: cannot open file1

Baøi taäp:

1. Haõy taïo chöông trình sau trong thö muïc tieáp nhaän:
-

chöông trình “hello”:

$

cat >

hello

print ”Hello”
print “How are you ?”
^D

-

chöông trình reply:

$

cat >

reply

print “Hello”
print “Fine. And you ?”
^D

2. Xem quyeàn thaâm nhaäp vaøo caùc file treân:

ll

-R

3. Chaïy 2 chöông trình treân.