Mailinglist Archive: opensuse-security (408 mails)
| < Previous | Next > |
Re: [suse-security] OT: User accounts
- From: Steffen Dettmer <steffen@xxxxxxx>
- Date: Sat, 6 Apr 2002 15:53:46 +0200
- Message-id: <20020406155346.A10495@xxxxxxxxx>
* BLeonhardt@xxxxxxxxxxx wrote on Wed, Apr 03, 2002 at 14:01 +0200:
> 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 ... !
First, backup /etc/passwd, /etc/shadow, /etc/group :)
I would suggest to just create such a script. It's easy. Imagine,
you have a file with a line for each user like
user1 pass1
user2 pass2
and so on. pass shouldn't have spaces I guess. Call it i.e.
new_users. Well, then create a bash script like:
#!/bin/bash
#This is an untested example
while read a b ; do
echo -n user: $a
useradd -m $USERADDOPTS $a
echo "$a:$b" | chpasswd
echo " OK"
done < new_users
USERADDOPTS can carry additionally parameters (try
useradd --help).
(put the code in a file, chmod +x it, execute it. Feel free to
add something. Please check it before using it :). Try it with
one or two accounts, adjust it, and finally just use it :)).
I don't recommend to edit /etc/passwd or /etc/shadow directly at
all. There are already tools build for that that care about
security, safeness, races, tmpfiles and so on.
It's GNU/Linux, so just use it :)
oki,
Steffen
--
Dieses Schreiben wurde maschinell erstellt,
es trägt daher weder Unterschrift noch Siegel.
> 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 ... !
First, backup /etc/passwd, /etc/shadow, /etc/group :)
I would suggest to just create such a script. It's easy. Imagine,
you have a file with a line for each user like
user1 pass1
user2 pass2
and so on. pass shouldn't have spaces I guess. Call it i.e.
new_users. Well, then create a bash script like:
#!/bin/bash
#This is an untested example
while read a b ; do
echo -n user: $a
useradd -m $USERADDOPTS $a
echo "$a:$b" | chpasswd
echo " OK"
done < new_users
USERADDOPTS can carry additionally parameters (try
useradd --help).
(put the code in a file, chmod +x it, execute it. Feel free to
add something. Please check it before using it :). Try it with
one or two accounts, adjust it, and finally just use it :)).
I don't recommend to edit /etc/passwd or /etc/shadow directly at
all. There are already tools build for that that care about
security, safeness, races, tmpfiles and so on.
It's GNU/Linux, so just use it :)
oki,
Steffen
--
Dieses Schreiben wurde maschinell erstellt,
es trägt daher weder Unterschrift noch Siegel.
| < Previous | Next > |