Gran parte del lavoro viene fatto dallo script adduser di cui riporto il sorgente: #!/bin/sh # # umask 022 NAWK=/bin/nawk # nawk (or gawk) binary GREP=/bin/grep # grep binary GNU_CP=/usr/local/bin/cp # GNU version of cp GNU_TAR=/usr/local/bin/gtar PASSWD=/etc/passwd # password file USERGID=100 # group to assign users for USERUID=500 # first uid for users MAXUID=32767 # max. uid for users USERBASE=/users/01 # users directories base USERSHELL=/bin/lynx # users default shell SHARE_DIR=/usr/export/sd1c/shared # home directory skeleton SKEL_DIR=/usr/export/sd1c/skel # files to be copied # # Validate parameters # if [ $# != 3 ]; then echo usage: adduser [login-name] [full name] [encrypted pwd] exit 1 fi login=$1 realname=$2 password=$3 # verify we don't get blank login name. NOTE: The caller *must* verify # the login name does not contain spaces, CRs or ':' for obvious security # reasons. if [ "$login" = "" -o "$realname" = "" ]; then echo adduser: invalid login or real name attempted. exit 1 fi # # Verify login name does not already exist # if $GREP "^$login:" $PASSWD > /dev/null; then echo $login: account already exists exit 1 fi # # Look up uid # XXX Does not make sure a uid *could* be allocated XXX # XXX Also, passwd comments may screw things... XXX # newuid=`$NAWK 'BEGIN { FS = ":" ; newuid = USERUID } { if ($3 >= newuid && $3 < MAXUID) newuid = $3+1 } END { print newuid }' MAXUID=$MAXUID USERUID=$USERUID $PASSWD` # create home directory/environment: mkdir $USERBASE/$login # jail root homedir=$USERBASE/$login/./home # home mkdir $homedir chown $newuid.$USERGID $homedir $GNU_CP -al $SHARE_DIR/* $USERBASE/$login $GNU_CP $SKEL_DIR/pinerc $homedir/.pinerc chown $newuid.$USERGID $homedir/.pinerc # create jailed password file jailpasswd=$USERBASE/$login/etc/passwd echo "root:*:0:0:root:/:/dev/null" > $jailpasswd echo "$login:*:$newuid:$USERGID:$realname:/home:$USERSHELL" >> $jailpasswd # append user to real passwd echo "$login:$password:$newuid:$USERGID:$realname:$homedir:$USERSHELL" >> $PASSW D # set quota for user edquota -p quota $login Importanti sono quindi le directory shared e skel... shared: [root@users]/usr/export/sd1c/shared>ls -latrg total 6 d--x--x--x 2 root staff 512 Nov 8 1995 etc/ drwxrwxrwt 2 root staff 512 Nov 8 1995 tmp/ drwxr-xr-x 6 root daemon 512 Nov 8 1995 ./ d--x--x--x 3 root staff 512 Nov 8 1995 usr/ d--x--x--x 2 root staff 512 Nov 10 1995 bin/ drwxr-xr-x 12 root wheel 512 May 28 10:40 ../ etc contiene: [root@users]/usr/export/sd1c/shared/etc>ls -latrg total 150 -r--r--r-- 773 root staff 32 Oct 30 1995 group -r--r--r-- 773 root staff 62 Nov 8 1995 resolv.conf d--x--x--x 2 root staff 512 Nov 8 1995 ./ -r--r--r-- 773 root staff 133439 Nov 8 1995 termcap drwxr-xr-x 6 root daemon 512 Nov 8 1995 ../ -r--r--r-- 773 root staff 1107 Nov 10 1995 lynx.cfg di cui - group wheel::0: staff::1: users::100: - resolv.conf domain intf.com nameserver 206.20.95.3 nameserver 206.20.95.4 - termcap (allego il file) - lynx.cfg (gia' in documentazione) in bin [root@users]/usr/export/sd1c/shared/bin>ls -la total 2818 d--x--x--x 2 root staff 512 Nov 10 1995 ./ drwxr-xr-x 6 root daemon 512 Nov 8 1995 ../ ---x--x--x 773 root staff 188416 Sep 19 1995 ls* ---x--x--x 773 root staff 565248 Sep 26 1995 lynx* ---x--x--x 773 root staff 303104 Sep 26 1995 pico* ---x--x--x 773 root staff 1261568 Sep 26 1995 pine* ---x--x--x 2319 root staff 131072 Nov 10 1995 sb* ---x--x--x 773 root staff 106496 Nov 8 1995 sh* ---x--x--x 2319 root staff 131072 Nov 10 1995 sx* ---x--x--x 2319 root staff 131072 Nov 10 1995 sz* che sono ovviamente tutti hard linked... in tmp [root@users]/usr/export/sd1c/shared/tmp>ls -latrg total 2 drwxrwxrwt 2 root staff 512 Nov 8 1995 ./ drwxr-xr-x 6 root daemon 512 Nov 8 1995 ../ in usr [root@users]/usr/export/sd1c/shared/usr>ls -la total 3 d--x--x--x 3 root staff 512 Nov 8 1995 ./ drwxr-xr-x 6 root daemon 512 Nov 8 1995 ../ d--x--x--x 3 root staff 512 Nov 8 1995 share/ dove in share abbiamo lib [root@users]/usr/export/sd1c/shared/usr/share>ls -latrg total 3 d--x--x--x 3 root staff 512 Nov 8 1995 ../ d--x--x--x 3 root staff 512 Nov 8 1995 ./ d--x--x--x 3 root staff 512 Nov 8 1995 lib/ e poi [root@users]/usr/export/sd1c/shared/usr/share/lib/terminfo>ls -latrg total 3 d--x--x--x 3 root staff 512 Nov 8 1995 ../ d--x--x--x 3 root staff 512 Nov 8 1995 ./ d--x--x--x 2 root staff 512 Nov 8 1995 v/ ot@users]/usr/export/sd1c/shared/usr/share/lib/terminfo/v>ls -latrg total 4 d--x--x--x 3 root staff 512 Nov 8 1995 ../ d--x--x--x 2 root staff 512 Nov 8 1995 ./ -r--r--r-- 773 root staff 1249 Nov 8 1995 vt100 dove vt100 e' hard linked. Per quanto riguarda la directory skel, invece, contiene: root@users]/usr/export/sd1c/skel>ls -latrg total 8 -rw-r--r-- 1 root daemon 5536 Nov 14 1995 pinerc drwxr-xr-x 2 root daemon 512 Nov 14 1995 ./ drwxr-xr-x 12 root wheel 512 May 28 10:40 ../ dove pinerc e': # Updated by Pine(tm) 3.91, copyright 1989-1993 University of Washington. # Pine configuration file -- customize as needed. # # This file sets the configuration options used by Pine and PC-Pine. If you # are using Pine on a Unix system, there may be a system-wide configuration # file which sets the defaults for these variables. There are comments in # this file to explain each variable, but if you have questions about # specific settings see the section on configuration options in the Pine # notes. On Unix, run pine -conf to see how system defaults have been set. # For variables that accept multiple values, list elements are separated # by commas. A line beginning with a space or tab is considered to be a # continuation of the previous line. For a variable to be unset its value # must be blank. To set a variable to the empty string its value should # be "". You can override system defaults by setting a variable to the # empty string. Switch variables are set to either "yes" or "no", and # default to "no". # Lines beginning with "#" are comments, and ignored by Pine. ########################### Essential Parameters ########################### # Over-rides your full name from Unix password file. Required for PC-Pine. personal-name= # Sets domain part of From: and local addresses in outgoing mail. user-domain=internetforce.com # List of SMTP servers for sending mail. If blank: Unix Pine uses sendmail. smtp-server=mail.internetforce.com # NNTP server for posting news. Also sets news-collections for news reading. nntp-server=news.internetforce.com # Path of (local or remote) INBOX, e.g. ={mail.somewhere.edu}inbox # Normal Unix default is the local INBOX (usually /usr/spool/mail/$USER). inbox-path=.mailbox ###################### Collections, Folders, and Files ##################### # List of incoming msg folders besides INBOX, e.g. ={host2}inbox, {host3}inbox # Syntax: optnl-label {optnl-imap-host-name}folder-path incoming-folders= # List of directories where saved-message folders may be. First one is # the default for Saves. Example: Main {host1}mail/[], Desktop mail\[] # Syntax: optnl-label {optnl-imap-hostname}optnl-directory-path[] folder-collections= # List, only needed if nntp-server not set, or news is on a different host # than used for NNTP posting. Examples: News *[] or News *{host3/nntp}[] # Syntax: optnl-label *{news-host/protocol}[] news-collections= # Over-rides default path for sent-mail folder, e.g. =old-mail (using first # folder collection dir) or ={host2}sent-mail or ="" (to suppress saving). # Default: sent-mail (Unix) or SENTMAIL.MTX (PC) in default folder collection. default-fcc= # Over-rides default path for postponed messages folder, e.g. =pm (which uses # first folder collection dir) or ={host4}pm (using home dir on host4). # Default: postponed-mail (Unix) or POSTPONE.MTX (PC) in default fldr coltn. postponed-folder= # If set, specifies where already-read messages will be moved upon quitting. read-message-folder= # Over-rides default path for signature file. Default is ~/.signature signature-file= # List of file or path names for global/shared addressbook(s). # Default: none # Syntax: optnl-label path-name global-address-book= # List of file or path names for personal addressbook(s). # Default: ~/.addressbook (Unix) or \PINE\ADDRBOOK (PC) # Syntax: optnl-label path-name address-book= ############################### Preferences ################################ # List of features; see Pine's Setup/options menu for the current set. # e.g. feature-list= select-without-confirm, signature-at-bottom # Default condition for all of the features is no-. feature-list=old-growth, signature-at-bottom # Pine executes these keys upon startup (e.g. to view msg 13: i,j,1,3,CR,v) initial-keystroke-list= # Only show these headers (by default) when composing messages default-composer-hdrs= # Add these customized headers (and possible default values) when composing customized-hdrs= # Determines default folder name for Saves... # Choices: default-folder, by-sender, by-from, by-recipient, last-folder-used. # Default: "default-folder", i.e. "saved-messages" (Unix) or "SAVEMAIL" (PC). saved-msg-name-rule= # Determines default name for Fcc... # Choices: default-fcc, by-recipient, last-fcc-used. # Default: "default-fcc" (see also "default-fcc=" variable.) fcc-name-rule= # Sets presentation order of messages in Index. Choices: # subject, from, arrival, date, size. Default: "arrival". sort-key= # Sets presentation order of address book entries. Choices: dont-sort, # fullname-with-lists-last, fullname, nickname-with-lists-last, nickname # Default: "fullname-with-lists-last". addrbook-sort-rule= # Reflects capabilities of the display you have. Default: US-ASCII. # Typical alternatives include ISO-8859-x, (x is a number between 1 and 9). character-set= # Specifies the program invoked by ^_ in the Composer, # or the "enable-alternate-editor-implicitly" feature. editor= # Program to view images (e.g. GIF or TIFF attachments). image-viewer= # If "user-domain" not set, strips hostname in FROM address. (Unix only) use-only-domain-name=Yes ########## Set within or by Pine: No need to edit below this line ########## # Your printer selection printer= # Special print command if it isn't one of the standard printers personal-print-command= # Set by Pine; controls beginning-of-month sent-mail pruning. last-time-prune-questioned=95.11 # Set by Pine; controls display of "new version" message. last-version-used=3.91 --------------------------- Ricordiamo inoltre che su users il password file era: root:oSYrYoPLJ9yrO:0:1:Marco Iannacone,Internet Force,+39-2-39210765,+39-2-26414228:/:/usr/local/bin/ tcsh nobody:*:65534:65534::/:/bin/nosh daemon:*:1:1::/:/bin/nosh sys:*:2:2::/:/bin/nosh bin:*:3:3::/bin:/bin/nosh uucp:*:4:8::/not-used:/bin/nosh news:*:6:6::/var/spool/news:/bin/nosh majordomo:*:7:7::/usr/local/majordomo:/bin/nosh operator:*:999:0:System Operator:/:/bin/nosh www:ts69EN5i9CrR0:88:88:WWW administrator:/usr/local/etc/httpd/./:/bin/lynx ftp:*:30:30::/usr/local/ftp:/ftponly quota:*:31:10:quota:/not-used:/bin/nosh yogo:kji1mnsR74D/r:1000:100:Yossi:/users/01/yogo/./home:/bin/lynx Mentre group wheel:*:0: nogroup:*:65534: daemon:*:1: kmem:*:2: bin:*:3: tty:*:4: operator:*:5: news:*:6: majordomo:*:7: uucp:*:8: audit:*:9: staff:*:10: other:*:20: www:*:88: olr:*:89: ftp:*:30: users:*:100: world:*:110: omega:*:120: