Re: shell script



Cameron Simpson wrote:
On 05Apr2008 09:46, mark <m.roth2006@xxxxxxx> wrote:
| Anil Saini wrote:
| > i need a shell script that can create multiple users....
| > i have already done it with newuser command..and worked fine
| > is thr any other way to create multiple user accouts and at the same it will
| > generate some random password...
| | Generate a random password? And how will you know what it is to tell the user?

By recording it in a file and printing them on little slips of paper, then
erasing the file? Hand the printouts to each user when they show up?
Force them to change them.

| And how many users are you adding at once? I've never added more than one or
| two at a time, and my standard new user is set up with a password that is
| *required* to be changed at first login... and I give them all the same:
| changeme. <g>

This is a better approach indeed.

Actually, its a pretty bad approach.

If you setup 1000 users with this, and I want to steal some accounts, all I need to do is login to my account, cat /etc/passwd then login to some of the other accounts that have yet to be 'activated' and change the passwords myself.

Sure, eventually some users will try to login and then complain they can't and the password will be reset - but that creates trouble for the admins and overhead that was not necessary. And there will usually be at least one or two accounts that are never used, or the student never complains about.

I used to make accounts without passwords (not blank, disabled) and get
the users to enter a password when they show up the first day.

However, this kind of thing doesn't work at places like universities
where 1000 new people show up at session start; then you do need to
give them all passwords.

You could probably write a wrapper script or a script to generate /etc/shadow and /etc/passwd entries and depending on how you wanted your users grouped, /etc/group entries as well and then create thir home directory, chown it to the newly created user and copy the contents of /etc/skel to the new home directory, chowning it in the process.

I did something similar when I had to create a few thousand new users based on a student database dump. (csv input)

--
Steve.

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list



Relevant Pages

  • RE: shell script
    ... you could also generate a changeme type password but ... in the user login or append the UID to the password. ... Subject: shell script ... If you setup 1000 users with this, and I want to steal some accounts, ...
    (RedHat)
  • Strange results from userls
    ... I am trying to whip up a simple script to report on user accounts ... last successful login on the account. ... successful login and last unsuccessful login. ...
    (comp.unix.sco.misc)
  • Redirecting STDOUT & STDERR
    ... I have this script I have been working on where I need to redirect STDOUT ... Accounts created: 1 ... # Create GECOS and login info and then create account using pw ... print MAIL "$from\n"; ...
    (perl.beginners)
  • Re: Can I link and identity to an account?
    ... > I have setup multiple accounts from 1 OE client. ... > login to OE and select which account I would like to use. ... > like identities allow for multiple users but not accessing multiple ... You can set up numerous accounts in one identity. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Create accounts in AD
    ... a .csv. ... I want to use a script or tool in w2k to create ... their accounts in AD and have the login names be ...
    (microsoft.public.win2000.active_directory)