If you can see this check that

next section            up prev page next page

Users, Permissions, Processes, and Pipes

USERS

UID and GID

Users

$ cat /etc/passwd

 root:x:0:0:root:/root:/bin/bash
 bin:x:1:1:bin:/bin:/sbin/nologin
 daemon:x:2:2:daemon:/sbin:/sbin/nologin

$ head -3 /etc/shadow

root:$1$RcFIaOlb$bwl5dvTECg3M1ZgMQ7e6I.:12663:0:99999:7:::
bin:*:12621:0:99999:7:::
daemon:*:12621:0:99999:7:::

$ tail -3 /etc/group

gdm:x:42:
dovecot:x:97:
mysql:x:27:

$ tail -3 /etc/gshadow

gdm:x::
dovecot:x::
mysql:x::

PERMISSIONS

Permissions

$ ls -l /etc/passwd

-rw-r--r--  1 root root 1639 Sep 14 14:38 /etc/passwd
-rxwrwxrwx
  |   \  \
  |    \  \__
  |     |    \
owner  group  other

File types

$ ls -ld /home

drwxr-xr-x  2 root root 4096 Jul 27 13:38 /home
> touch /tmp/test
> ls -l /tmp/test
-rw-r--r--  1 root root 0 Sep 23 15:47 /tmp/test
> chmod og+wx /tmp/test
> ls -l /tmp/test
-rw-rwxrwx  1 root root 0 Sep 23 15:47 /tmp/test
> ls -l /tmp/test
-rw-rwxrwx  1 ftp mem 0 Sep 23 15:47 /tmp/test
> chgrp root /tmp/test
> ls -l /tmp/test
-rw-rwxrwx  1 ftp root 0 Sep 23 15:47 /tmp/test

Numeric Notation

Example

$ umask 022

The umask mask

PROCESSES

Processes

$ ps aux

USER       PID %CPU %MEM   VSZ  RSS TTY      STAT START   TIME COMMAND
root       1    0.1  0.8  1480  496 ?        S    12:57   0:00 init [5]
root       2    0.0  0.0     0    0 ?        SWN  12:57   0:00 [ksoftirqd/0]
root       3    0.0  0.0     0    0 ?        SW<  12:57   0:00 [events/0]
root       4    0.0  0.0     0    0 ?        SW<  12:57   0:00 [khelper]
root       16   0.0  0.0     0    0 ?        SW   12:57   0:00 [kjournald]
...
root       527  0.0  0.9  1464  576 ?        S    12:58   0:00 syslogd -m 0
rpc        553  0.0  0.9  1544  584 ?        S    12:58   0:00 portmap
rpcuser    573  0.1  1.3  1644  812 ?        S    12:58   0:00 rpc.statd
root       658  0.4  2.4  3656 1484 ?        S    12:58   0:00 /usr/sbin/sshd
gordon   15521  0.0  0.1  3992  760 pts/1    R    20:41   0:00 ps aux

State Codes

Process Relationships

$ pstree

       init---anacron
	      +-atd(daemon)
	      +-crond 
	      +-sshd---sshd---bash---pstree
	      +-syslogd
	      +-xfs(xfs)
	      +-xinetd

/proc

$ ls -l /proc/668

-r--------  1 root root 0 Sep 21 16:32 auxv
-r--r--r--  1 root root 0 Sep 21 16:31 cmdline
lrwxrwxrwx  1 root root 0 Sep 21 16:32 cwd -> /
-r--------  1 root root 0 Sep 21 16:32 environ
lrwxrwxrwx  1 root root 0 Sep 21 16:32 exe -> /usr/sbin/sshd
dr-x------  2 root root 0 Sep 21 16:32 fd
-r--r--r--  1 root root 0 Sep 21 16:32 maps
-rw-------  1 root root 0 Sep 21 16:32 mem
-r--r--r--  1 root root 0 Sep 21 16:32 mounts
lrwxrwxrwx  1 root root 0 Sep 21 16:32 root -> /
-r--r--r--  1 root root 0 Sep 21 16:31 stat
-r--r--r--  1 root root 0 Sep 21 16:32 statm
-r--r--r--  1 root root 0 Sep 21 16:31 status
dr-xr-xr-x  3 root root 0 Sep 21 16:32 task
-r--r--r--  1 root root 0 Sep 21 16:32 wchan

$ ls -l /proc/668/fd

lrwx------  1 root root 64 Sep 21 16:32 0 -> /dev/null
lrwx------  1 root root 64 Sep 21 16:32 1 -> /dev/null
lrwx------  1 root root 64 Sep 21 16:32 2 -> /dev/null
lrwx------  1 root root 64 Sep 21 16:32 3 -> socket:[4230]
> sleep 20 > /tmp/hia &
[1] 854
> ls -l /proc/854
> ls -l /proc/854/fd
lrwxrwxrwx  1 root root 0 Sep 21 16:45 cwd -> /root
-r--------  1 root root 0 Sep 21 16:45 environ
lrwxrwxrwx  1 root root 0 Sep 21 16:45 exe -> /bin/sleep
dr-x------  2 root root 0 Sep 21 16:45 fd

lrwx------  1 root root 64 Sep 21 16:45 0 -> /dev/pts/0
l-wx------  1 root root 64 Sep 21 16:45 1 -> /tmp/hia
lrwx------  1 root root 64 Sep 21 16:45 2 -> /dev/pts/0

Daemons

$ top

top - 16:03:17 up  1:04,  1 user,  load average: 0.00, 0.00, 0.00
Tasks:  35 total,   2 running,  33 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0% us,  0.0% sy,  0.0% ni, 100.0% id,  0.0% wa,  0.0% hi,  0.0% si
Mem:     59764k total,    52308k used,     7456k free,     6192k buffers
Swap:   205816k total,        0k used,   205816k free,    32472k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  807 root      16   0  1624  728 1412 R  0.0  1.2   0:00.02 in.telnetd
  934 root      16   0  1828  872 1628 R  0.0  1.5   0:00.00 top

SYSLOG

$ who

root     pts/0        Sep 21 15:59 (hub1-gw)

$ ls -l /dev/pts/0

crw--w----  1 root tty 136, 0 Sep 21 16:49 /dev/pts/0

mknod

$ man ps

PIPES

Pipes

HARD and SOFT LINKS

File links

Hard Link

% ln hardfile project/hardfile2 
% ls -l projects/hardfile2
 -rwx-xr-x 2 john users 605 Nov 18 12:25 hardfile 

% ls -l projects/hardfile2 
-rwx-xr-x 2 john users 605 Nov 18 12:25 hardfile 

Soft Links

Soft Links

lrwx-xr-x 1 john users 605 Nov 18 12:25 
		softfile2 -> /home/staff/john/softfile 

Discussion

Future of file permission:


Tutlinks: intro1 intro2 wildcard permission pipe vi essential admin net fwall DNS diag Apache1 Apache2 MySQL1 MySQL2
Useful: Quiz Forums
Site Links:XMLZoo ActiveSQL ProgZoo SQLZoo