Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 06-16-2006, 07:23 PM   #1
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Rep: Reputation: 15
mkpasswd with FC4

I am trying to run the following command in Fedora Core 4:

adduser -m -p "`mkpasswd intialpassword`" username

This successfully adds the user and copies all the files from the skeleton directory but the idea behind mkpasswd was to pass a regular password and encrypt it but allow the user to login using the intialpassword value, so you don't manually have to assign a password to the user using the passwd command.

Here is the problem I am having: The mkpasswd command doesn't seem to work on FC4. I have done a locate mkpasswd and nothing comes up. I have tried installing the whois rpm (although not for my specific OS) and it said it conflicted with another mkpasswd on my system. I am very confused. Is there any way to get mkpasswd on an FC4 OS or is there another way to do this by assigning a password and keeping it from being encrypted so you can then login. (I need to use this command in a shell script so something that doesn't require user input is best)

Any help appreciated.
Old 06-16-2006, 08:03 PM   #2
LQ Newbie
Registered: Apr 2005
Location: Black Hawk, Colorado
Distribution: Ubuntu
Posts: 26

Rep: Reputation: 15

echo "username:initialpassword" | chpasswd

help you?

It doesn't set a temporary password, though you can use other commands to make the pw expired..
Old 06-16-2006, 08:57 PM   #3
Senior Member
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 60
A quick google shows that mkpasswd is part of the expect package.
If mkpasswd doesn't show up using the locate command, but does show up from the command: whereis mkpasswd then run the command: updatedb and try the locate command again.

# locate mkpasswd

# whereis mkpasswd
mkpasswd: /usr/bin/mkpasswd /usr/share/man/man1/mkpasswd.1.gz

I had success using the command like this ...
# (adduser fred ; mkpasswd fred)
e7ZJ3z;jy ## Note: this is an example of the password that is generated.
If you didn't want the client to know a password in advance, you could give them a null password and force them to make a new one at first login.
For example:
useradd fred
passwd -f -u fred
chage -d0 fred
Maybe some more reading on the chage commmand....
Old 06-16-2006, 10:15 PM   #4
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Original Poster
Rep: Reputation: 15
My whereis command:
[root@localhost rpms]# whereis mkpasswd
[root@localhost rpms]#

I used updatedb and I also have that cron to do that enabled as well here is what I get fromr locate.

[root@localhost rpms]# locate mkpasswd
[root@localhost rpms]#

I was going to use the mkpasswd command not to generate random passwords but to allow me to add nonencrypted passwords to the -p command of adduser.

Thanks for the fast replies.
Old 06-16-2006, 10:18 PM   #5
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Original Poster
Rep: Reputation: 15
Also, whereis doesn't seem to be a very valuable tool, for example:

[root@localhost rpms]# moneky
bash: moneky: command not found
[root@localhost rpms]# whereis monkey
[root@localhost rpms]#

It will return the value you put in.
Old 06-16-2006, 10:20 PM   #6
Registered: Feb 2006
Distribution: Red Hat 9
Posts: 112

Original Poster
Rep: Reputation: 15
Actually ignore those 2 posts. I did:

yum install expect

I now have the mkpasswd command working. Not quite sure how to incorporate it into the adduser command, but I will work on that.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
mkpasswd in Debian swmok Debian 4 06-05-2005 08:30 PM
Using mkpasswd with passwd lapthorn Linux - Security 2 02-23-2005 08:53 AM
mkpasswd/group? vickr1z Linux - Newbie 0 09-23-2004 03:52 PM
mkpasswd LinuxRam Linux - Security 1 08-24-2004 04:24 AM
mkpasswd gadfly Slackware 2 09-13-2003 10:26 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:03 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration