newbie: adding users/ changing passwords...

newbie: adding users/ changing passwords...

Post by Geir » Sun, 31 Dec 1899 09:00:00



Is it possible to add a new user and give the new user a password in one
single command?

I know that I can do:

"adduser newuser"

and then

"passwd newuser"

to change the password manually (when logged in as root).
However, the "passwd"-command asks you to type the password, and I would
like to be able to specify the password on the commandline; something
like this:

"passwd newuser newpasswd",

this would the set "newuser" password to "newpassword". How can this be
done?

Geir.

 
 
 

newbie: adding users/ changing passwords...

Post by Tony Lawrenc » Sun, 31 Dec 1899 09:00:00



> Is it possible to add a new user and give the new user a password in one
> single command?

> I know that I can do:

> "adduser newuser"

> and then

> "passwd newuser"

> to change the password manually (when logged in as root).
> However, the "passwd"-command asks you to type the password, and I would
> like to be able to specify the password on the commandline; something
> like this:

> "passwd newuser newpasswd",

> this would the set "newuser" password to "newpassword". How can this be
> done?

You can make two simple scripts that do the job for you:

#!/bin/sh
# myadduser script
# usage : myadduser name password
useradd $1
expass $1 $2

This is the "expass" script called by the first script:

#!/usr/bin/expect -f
set password [lindex $argv 1]
spawn /bin/passwd [lindex $argv 0]
expect "assword:"
send "$password:\r"
expect "assword:"
send "$password:\r"
expect eof

--

SCO/Linux articles, help, book reviews, tests,
job listings and more : http://www.pcunix.com

 
 
 

newbie: adding users/ changing passwords...

Post by Andrew N. McGuir » Sun, 31 Dec 1899 09:00:00


On Tue, 15 Aug 2000, Geir quoth:

~~ Date: Tue, 15 Aug 2000 21:55:53 +0200

~~ Newsgroups: comp.os.linux.misc
~~ Subject: newbie: adding users/ changing passwords...

[ snip ]

~~ However, the "passwd"-command asks you to type the password, and I would
~~ like to be able to specify the password on the commandline; something
~~ like this:
~~
~~ "passwd newuser newpasswd",
~~
~~ this would the set "newuser" password to "newpassword". How can this be
~~ done?

[ snip ]

Yes, and someone has already replied with one way to do it...
However, I would like to point something out from a security
standpoint.


anm       2152  2138  0 21:33 pts/0    00:00:00 grep PLAIN

if your are concerned.  If plain text passwords showing up in
the process table does not matter to you, so be it.

Regards,

anm
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Andrew N. McGuire                                                      ~

~ "Plan to throw one away; you will, anyhow." - Frederick P. Brooks, Jr. ~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

 
 
 

1. Adding users and changing passwords (in scripts)

Hi!

I want to make a script that adds a user to the system - well you
could just use useradd...right? I have tried that, but the system
doesn't allow me to login as the newly created user. I checked the
passwd file - and the user was listed.

I think it's my password - I used the useradd -p [password] option - it
doesn't seem to work.

Any other solutions?

BTW: The script is running as root...

Thanx....
Janus N. T?ndering, Denmark

2. *****I NEED HELP!!!!*****

3. Adding users, changing passwords with PHP

4. XDM Problem

5. Bad stuff happening; can't add new users, change passwords, etc

6. Bus Error with NetScape -- which libc to use?

7. How to add user account and change password with NIS+ in Solaris 8?

8. finding a pid

9. password does not allow add a password for a new user with a Permission denied

10. scoadmin -> Account Manager -> Users -> Add New Users breaks /etc/password symlink

11. NIS+ user management [Was: Re: root changing a user's password (NIS)]

12. Add user that can add users?

13. Red Hat will not allow password changes or new accounts to be added