16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Processes I<br />

! Shadow Password<br />

/etc/shadow set so that only superuser can read.<br />

The encrypted-password field is set to an asterisk.<br />

! Group File<br />

/etc/group<br />

group-name:encypted-password:group-ID:user-list<br />

BSD4.3:<br />

System V:<br />

can be a member of up to 16 groups at login<br />

you change groups <strong>with</strong> <strong>the</strong> newgrp command<br />

#include <br />

struct group *getgrgid(int gid);<br />

struct group *getgrnam(char *name);<br />

struct group {<br />

char *gr_name; /* group-name */<br />

char *gr-passwd; /* encrypted-password */<br />

int gr_gid; /* group-ID */<br />

char **gr_mem; /* array of ptrs to user-list */<br />

};<br />

! Shells<br />

/bin/sh Bourne shell<br />

/bin/ksh Korne shell<br />

/bin/csh C shell<br />

/bin/tcsh Enhanced C shell<br />

! Filenames<br />

limit of 14 to 256 characters<br />

NULL ('\0') terminates pathname<br />

slash ('/') separates filenames<br />

characters interpreted by shell are not recommended *, [, ], -<br />

! Pathname<br />

relative – path begins at current directory<br />

absolute – starts <strong>with</strong> a slash (from root)<br />

! File Descriptor<br />

a small integer used to identify a file that has been opened for I/O<br />

0 standard input<br />

1 standard output<br />

2 standard error<br />

assigned by <strong>the</strong> kernel by a system call {open, creat, dup, pipe, fcntl}<br />

! Files<br />

#include <br />

#include <br />

int stat(char *pathname, struct stat *buf);<br />

int fstat(int fildes, strut stat *buf);<br />

struct stat {<br />

ushort st_mode; /* file type & access perms */<br />

ino_t st_dev; /* i-node number */<br />

dev_t st_dev; /* ID of device containing directory entry for file */<br />

short st_nlink; /* number of links */<br />

ushort st_uid; /* user ID */<br />

ushort st_gid; /* group ID */<br />

112

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!