Date: Fri, 15 Dec 2000 23:42:58 -0500 (EST) To: dwen Subject: Creation of remote home directories Re: rsync On Sat, 16 Dec 2000, dwen wrote: > but im not good in programming. > can you do that for me ? I hope this is not a home work assignment ... if so, you should be doing it. #!/bin/sh # cp /etc/passwd /etc/passwd.tmp diff /etc/passwd.tmp /etc/passwd.old > /tmp/newusers grep '^<' /tmp/newusers | awk {'print $2 '} | \ awk -F ":" {'print $1',":",$6} \ > /tmp/newarray for i in `cat /tmp/newarray`; do THEUSER=` echo $i | awk -F ":" {'print $1'} ` HOMES=` echo $i | awk -F ":" {'print $2'} ` mkdir $HOMES chown $THEUSER.$THEUSER $HOMES chmod 755 $HOMES done mv /etc/passwd.tmp /etc/passwd.old rm /tmp/newarray cat /tmp/newusers # This is untested, but should work ... I encourage you to study the code, and test it, a line at a time, to see how it works. > > 1. save a copy of the password file as passwd.tmp > > > > 2. diff it against a file 'passwd.old' > > > > 3. if the diff is non-null, create a local home directory for > > each newly added userid, found by the diff > > > > 4. rename passwd.tmp to passwd.old > > > > 5. exit > > > > Hope this helps ...