[NTLUG:Discuss] create user account

Thomas Cameron thomas.cameron at camerontech.com
Mon Jan 23 00:37:11 CST 2006


On Mon, 2006-01-16 at 12:40 -0600, Charles Cashion wrote:
> I want to create a user account for my grandson.
> The computer is running FC4.
> when I ran
> [root]# useradd -p sonofjohn bcashion
> It created entries in /etc/passwd and /etc/shadow
> and it created /home/bcashion
> But when I tried
> [root]# su bcashion
> password: sonofjohn
> it would not accept "sonofjohn" as password.
> 
> Then I cleaned out what I had created
> [root]# userdel bcashion
> Then I read "man useradd" and observed that it wanted
> the password to pass thru "encrypt(3)" first. So I
> tried to create the account without a password
> [root]# useradd bcashion
> It created entries in /etc/passwd and /etc/shadow
> and it created /home/bcashion
> And when I tried
> [root]# su bcashion
> It did NOT ask for password and it returned
> [/home/bcashion ~]
> So I thought I was in until I logged completely off
> and tried to log back in as bcashion. The login
> wants a password.
> 
> Tnx,
> Charles

You can run the command grub-md5-crypt to generate an appropriate
password, then pass that password to useradd, as below:

[root at wintermute ~]# grub-md5-crypt
Password:
Retype password:
$1$gMKUG1$5nnQeBW4xUO7MraFFytMQ1
[root at wintermute ~]# useradd -p '$1$gMKUG1$5nnQeBW4xUO7MraFFytMQ1'
testuser
[root at wintermute ~]# grep testuser /etc/shadow
testuser:$1$gMKUG1$5nnQeBW4xUO7MraFFytMQ1:13171:0:99999:7:::
[root at wintermute ~]# exit
[thomas.cameron at wintermute ~]$ su - testuser
Password:
[testuser at wintermute ~]$

Wherever I was prompted for a password, I entered the literal text
string password.  It worked just fine when I logged in as testuser.

Thomas





More information about the Discuss mailing list