ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • HPUX - File Permissions and Access
    IoT 과정 2017. 6. 20. 12:43
    반응형

    access type

    Owner, Group, Other

    -rwxrwx---   1 user11     class          141 Nov 13  1993 prog1

    -rw-rw----   1 user11     class           29 Nov 13  1993 yourfile

    /ow//gr//ot/    owner      group   ...   and other


    Files

    Read : Contents can be examined [cat filename]

    Write : Contents can be changed [vi filename]

    Execute : File can be used as a command 

    { eg)

          $ cat myprog

    # this is the program myprog

    date

    ls -F

    $ myprog

    Tue Jun 20 12:51:41 KST 2017

    README.exrc      color5*          grape            memo.bak/        mytrap2*         prog2*

    abcdefXlmnop     color6*          herfile          mod1.c           names            remind

    abcdefYlmnop     f1               infinite*        mod2.c           names.cp         root_file

          ....

     }


    Directory

    Read : Contents can be examined [ ls /root, /root unreadable (for general user)]

    Write : Contents can be changed [ mkdir /root/"filename", /root: Permission denied. rm /root/"filename", /root: Permission denied. mv /root/"filename" ... ]

    Execute : Can become current working directory [ cd /root, /root : Permission denied ]


    chomod (u,g,o,a)(+,-,=)(w,r,x) or (octal) "filename"

    {

    $ ll peach

    -rw-rw----   1 user11     class           16 Nov 13  1993 peach

    $ chmod u+x,g-w,o=r peach

    $ ll peach

    -rwxr--r--   1 user11     class           16 Nov 13  1993 peach

    $ chmod 333 peach
    $ ll peach
    --wx-wx-wx   1 user11     class           16 Nov 13  1993 peach
    }

    umask : inform initial permission condition [umask "octal number", subtract "octal number" from initial permission condition(set initial permission condition)]

    {

    $ umask

    02

    $ mkdir adir

    $ touch afile

    $ ls -ld adir

    drwxrwxr-x   2 user11     class           96 Jun 20 13:04 adir

    [directory permission condition 777(All Unix) subtract umask 02 = 775, rwxrwxr-x]

    $ ll afile

    -rw-rw-r--   1 user11     class            0 Jun 20 13:05 afile

    [file permssion condition 666(All Unix) subtract umask 02 = 664, rw-rw-r--]


    $ umask 022

    $ umask

    022

    $ mkdir bdir
    $ touch bfile
    $ ls -ld bdir
    drwxr-xr-x   2 user11     class           96 Jun 20 13:10 bdir
    $ ll bfile
    -rw-r--r--   1 user11     class            0 Jun 20 13:10 bfile

    }

    touch : create a new, empty file or modification times of file

    {

    $ touch yohanfile

    $ ls -l yohanfile

    -rw-rw-r--   1 user11     class            0 Jun 20 14:29 yohanfile

    $ ll lime

    -rw-rw----   1 user11     class           15 Nov 13  1993 lime

    $ touch lime

    $ ll lime

    -rw-rw----   1 user11     class           15 Jun 20 14:29 lime

    $ touch -m 06201200 lime
    $ ll lime
    -rw-rw----   1 user11     class           15 Jun 20 12:00 lime

    }


    chown "username" "filename" : change owner of file [ chown "username":"groupname" "filename" change owner and group of file]

    chgrp "groupname" "filename" : change group of file

    su "id" : switch User id [su root, su - "username", 로그인할 때 상대 Home directory의 .profile 참조]

    newgrp : changes the group ID

    {

    $ id

    uid=311(user11) gid=301(class) groups=302(class2)

    $ newgrp class2

    $ id

    uid=311(user11) gid=302(class2) groups=301(class)

    $ newgrp class

    $ id

    uid=311(user11) gid=301(class) groups=302(class2)


    $ touch testfile

    $ ll testfile

    -rw-rw-r--   1 user11     class            0 Jun 20 14:48 testfile

    $ newgrp class2

    $ touch dfile

    $ ll dfile

    -rw-rw-r--   1 user11     class2           0 Jun 20 14:49 dfile

    }


    review (modification)

    -rw-rw----   1 user11     class         3081 Jun 20 15:19 funfile

       chmod /  ln / chown / chgrp    / vi(size) / touch       / mv 




    반응형

    'IoT 과정' 카테고리의 다른 글

    HPUX - File Name Generation  (0) 2017.06.21
    HPUX - Shell Advanced Features  (0) 2017.06.21
    HPUX - Shell Basic  (0) 2017.06.21
    HPUX - vi  (0) 2017.06.20
    HPUX - File Permissions and Access  (0) 2017.06.20
    HPUX - Navigating the File System, Managing Files  (0) 2017.06.19

    댓글 0

Designed by Tistory.