1 / 18

System Data and Information

System Data and Information. systems files include password, group, hosts, services, etc. traditionally, systems files are in ASCII text format portable human readable contemporary usage calls for cleanly structured, possibly binary files for optimum performance, security. passwd File.

Download Presentation

System Data and Information

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. System Data and Information systems files include password, group, hosts, services, etc. traditionally, systems files are in ASCII text format portable human readable contemporary usage calls for cleanly structured, possibly binary files for optimum performance, security

  2. passwd File • structure defined in pwd.h • traditionally contains seven elements • username • encrypted password • user ID • group ID • comment (GECOS) • home directory • default shell

  3. passwd File Entries • contains root (UID 0) • one-way encrypted password • can be ‘reverse engineered’ if visible • fields may be empty • some systems support ‘structured’ comment field

  4. passwd functions • five basic functions • getpwuid() - fetch entry from uid • getpwnam() - fetch entry from login name • getpwent() - get next entry • setpwent() - rewinds stream(s) • endpwent() - closes stream(s)

  5. passwd function details • getpwuid, getpwnam, and getpwent all return pointers to passwd entry structures • passwd entry structures are usually static within the function, and are overwritten by subsequent calls • getpwent opens files automatically, but endpwent must be called to close.

  6. Shadow Passwords • encrypted passwords can be exploited for access to systems • scan ‘dictionary’ for common matches • encrypt and compare • shadow password files hide encrypted passwords from world • only limited number of system programs need access to encrypted passwords in ‘shadow file’

  7. Group File • group file structures contain four elements • group name • encrypted password (almost never used) • group ID • array of ptrs to user names

  8. group file functions • like passwd, five basic file functions • getgrgid() - fetch entry from gid • getgrnam() - fetch entry from login name • getgrent() - get next entry • setgrent() - rewind stream(s) • endgrent() - close streams(s)

  9. Supplementary Group IDs • originally, all users had one (login) group • ‘newgrp’ command used to change effective GID • today, users can belong to as many as 16 supplementary groups • file permissions are checked against both login group, and supplementary groups

  10. Supplementary GID functions • there are three primary supplementary GID functions • getgroups() - get supplementary GIDs for user • setgroups() - set supplementary GIDs for user (superuser only) • initgroups() - read group file and set groups including login group (superuser only)

  11. Accessing Other System Data Files • other files use same access function types • two keyed search functions (if supported) • three file ‘walking’ functions • get next entry • set to first entry (rewind) • end (close all files)

  12. Other Data Files • some data files common to almost all installations • hosts - list of hostnames matched to network addresses • networks - list of networks supported • protocols - list of protocols supported • services - list of services supported

  13. uname() details • uname returns five element structure • sysname - name of OS • nodename - name of node • release - current release of OS • version - current version of release • machine - hardware type

  14. Login Accounting • two primary login accounting files • utmp - currently logged in users • wtmp - all logins and logouts • structures vary from machine to machine • not all machines have low level functions for access • those that do have functions that generally mirror the other file access functions, a ‘get’, a ‘set’, and an ‘end’

  15. System Identification • two primary functions for access to system ID information • uname() - returns structure with host information • gethostbyname() - returns network hostname

  16. Time and Date • basic time service returns number of seconds since ‘epoch’ (1/1/70). • time_t times are referred to as ‘calendar’ times • ‘break down’ functions convert time_t to tm structure • formatting functions produce ‘user friendly’ output

  17. Time tm structure functions • three main functions • ‘break down’ functions • gmtime() - universal time • localtime() - local time • ‘build up’ function • mktime() - convert tm to time_t

  18. time formatting functions • three main formatting functions • asctime() - default time string from tm • ctime() - default time string from time_t • strftime() - programmer definable format from tm

More Related