LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 03-04-2008, 06:50 PM   #1
johnblaze00
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Rep: Reputation: 0
mkpasswd


I am having trouble figuring out how to echo (if that is even possibly) the password that is created by the mkpasswd command. What i have to do is email that password to the user that is created. Anyone know if this is possible or a better alternative.

I am using fedora 7.
 
Old 03-04-2008, 07:17 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Hi,

And welcome to LQ!

I don't fully understand your request ... how are you using mkpasswd?
If you want to be able to e-Mail a temporary password to a user you could
do something like this ... (assuming that their account and e-Mail are identical).
Code:
username=one_user
newpwd=$(mkpasswd)
echo ${username}:${newpwd}|chpasswd
echo "Your new password is:'${newpwd}'"|mail -s pwd ${username}


Cheers,
Tink
 
Old 03-04-2008, 07:21 PM   #3
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,362

Rep: Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560Reputation: 560
Quote:
Originally Posted by johnblaze00 View Post
I am having trouble figuring out how to echo (if that is even possibly) the password that is created by the mkpasswd command. What i have to do is email that password to the user that is created. Anyone know if this is possible or a better alternative.

I am using fedora 7.
What you want to do is email the user the input to the mkpasswd command, not its output. The user need the plain version of the password not the encrypted output of mkpasswd.

------------------
Steve Stites
 
Old 03-04-2008, 07:26 PM   #4
johnblaze00
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Original Poster
Rep: Reputation: 0
thank you for the help so far guys, what i am trying to do is create a bunch of users from a csv file. I have all the users being read via awk and the useradd adds the users via a variable. What i have to do is then create a password for every user that is created. I then have to email the users that he account has been created with the password that has been created.

once again thank you for the help guys! seriously i have been racking my brain over this for the past two days. The best part was is when i finally figured out that the mkpasswd command doesn't work in fedora unless you install the "expect" package...
 
Old 03-04-2008, 07:52 PM   #5
johnblaze00
LQ Newbie
 
Registered: Mar 2008
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Tinkster View Post
Hi,

And welcome to LQ!

I don't fully understand your request ... how are you using mkpasswd?
If you want to be able to e-Mail a temporary password to a user you could
do something like this ... (assuming that their account and e-Mail are identical).
Code:
username=one_user
newpwd=$(mkpasswd)
echo ${username}:${newpwd}|chpasswd
echo "Your new password is:'${newpwd}'"|mail -s pwd ${username}


Cheers,
Tink
thanx tink, your suggestion helped and i was able to solve the problem. thank you once again!
 
  


Reply


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:13 PM.

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