RE: [suse-security] OT: User accounts
i just recognized that attachements do not make it to the list... so, here it comes: -------------------------------------- #!/usr/bin/perl -w $debug = 1; $exist = 0; open STDIN,"<"; while (<STDIN>){ $exist = 1; ($uname,$x,$uid,$gid,$comment,$homedir,$shell) = split ":",$_; chomp ($uname,$x,$uid,$gid,$comment,$homedir,$shell); # $debug && print " -- found $uname:$x:$uid:$gid:$comment:$homedir:$shell\n"; # checking whether user exist open PASSWD,"</etc/passwd"; while(<PASSWD>){ ($un,$xx,$u,$g,$c,$d,$s) = split ":",$_; chomp ($un,$xx,$u,$g,$c,$d,$s); if ($uname =~ /\$un/) { print " * User $uname already exist!\n"; $exist = 0; } else { $exist = 1; } } close PASSWD; if ($exist != 0) { # changing every shell to false? # $shell =~ s/(bash|csh|ksh|sh|tcsh)/false/g; if ($uid > 100){ print "Executing 'useradd -u $uid -g $gid -c \"$comment\" -d $homedir -s $shell $uname' ... "; #`useradd -u $uid -g $gid -c \"$comment\" -d $homedir -s $shell $uname`; print "done.\n"; } else { print " * useradd -u $uid -g $gid -c \"$comment\" -d $homedir -s $shell $uname\n"; } } else { print " * User $uname already exist!\n"; } } close STDIN; exit 0; ------------------------- -----Original Message----- From: Peer Stefan [mailto:stefan.peer@tiwag.at] Sent: Wednesday, April 03, 2002 2:15 PM To: Suse-Security Subject: RE: [suse-security] OT: User accounts i once wrote a script myself, which adds users from any unix-like password-file to a system (reads STDIN). have a look at the attachment. it's provided 'asis' - feel free to add or delete stuff as you like. cheers stefan ps: it just adds users with uids greater than 100 - so no system user is added. -----Original Message----- From: Michael Stern [mailto:mhstar@gmx.at] Sent: Wednesday, April 03, 2002 2:07 PM To: Suse-Security Subject: Re: [suse-security] OT: User accounts well of course you could create a script manually which reads and parses an input file and passes the data to useradd and whatever program you want to execute ... i don't know whether suse does provide one, but it shouldn't be too difficult to write such a script. ----- Original Message ----- From: <BLeonhardt@analytek.de> To: <suse-security@suse.com> Sent: Wednesday, April 03, 2002 2:01 PM Subject: [suse-security] OT: User accounts Hello, does anybody have a idea, how to generate more than 100 Users without having to add them manually or with YaST ? Is there anything like a skript ? The users need the home-dir's too ... ! Thank's ! Best Regards / Mit freundlichen Grüßen Bruno Leonhardt -- To unsubscribe, e-mail: suse-security-unsubscribe@suse.com For additional commands, e-mail: suse-security-help@suse.com Security-related bug reports go to security@suse.de, not here -- To unsubscribe, e-mail: suse-security-unsubscribe@suse.com For additional commands, e-mail: suse-security-help@suse.com Security-related bug reports go to security@suse.de, not here
participants (1)
-
Peer Stefan