LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-06-2009, 01:52 PM   #31
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98

Quote:
Originally Posted by kenneho View Post
Thanks, that's all I needed to know. I was hoping there would be some way of doing this directly from bash, but going for the perl method is not a problem.
As rweaver pointed out, and I'm not too big to admit, I was wrong.

Try:
Code:
#!/bin/bash
Password="Testing"
###
### Create encrypted password
###
l_encrypted_pass=$(mkpasswd --hash=md5 $Password)

echo "$l_encrypted_pass"
 
Old 01-07-2009, 01:36 AM   #32
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Rep: Reputation: 40
Quote:
Originally Posted by Disillusionist View Post
As rweaver pointed out, and I'm not too big to admit, I was wrong.

Try:
Code:
#!/bin/bash
Password="Testing"
###
### Create encrypted password
###
l_encrypted_pass=$(mkpasswd --hash=md5 $Password)

echo "$l_encrypted_pass"
I may have mentioned this before, but it looks like my version of mkpasswd doesn't have flags such as "hash". I've got flags to define the minimum number of special characters and so forth, but not hash type. Where did you guys get your mkpasswd package?
 
Old 01-07-2009, 01:44 AM   #33
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
For me, mkpasswd was already installed.

This is an old "feisty fawn" Ubuntu installation.

mkpasswd -V gives:
Quote:
GNU mkpasswd 4.7.20build2

Copyright (C) 2001-2004 Marco d'Itri
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
But, if you can't get mkpasswd to do what you need, there is still the perl script
 
Old 01-07-2009, 03:57 AM   #34
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Rep: Reputation: 40
I looks like my mkpasswd command is part of the "expect" package, so I'm guessing that maybe your mkpasswd is different than mine. My mkpasswd doesn't even have a "-V" option.

I think I'll have to settle with the perl script, then.
 
Old 01-07-2009, 09:07 AM   #35
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by kenneho View Post
I may have mentioned this before, but it looks like my version of mkpasswd doesn't have flags such as "hash". I've got flags to define the minimum number of special characters and so forth, but not hash type. Where did you guys get your mkpasswd package?
Strange, do a man on mkpasswd, you may have --hash but not md5 (aes, blowfish maybe?)

You can try this:

mkpasswd --hash=help

and it should display any available.
 
Old 01-07-2009, 10:23 AM   #36
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Rep: Reputation: 40
Quote:
Originally Posted by rweaver View Post
Strange, do a man on mkpasswd, you may have --hash but not md5 (aes, blowfish maybe?)

You can try this:

mkpasswd --hash=help

and it should display any available.
Yeah, it's strange. I don't have any hash option at all - I've searched the man page, and I've entered your command above. Is your mkpasswd part of another package, or did is come as a separate package?
 
Old 01-07-2009, 11:38 AM   #37
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by kenneho View Post
Yeah, it's strange. I don't have any hash option at all - I've searched the man page, and I've entered your command above. Is your mkpasswd part of another package, or did is come as a separate package?
I've got three systems in front of me that I just checked, it's in my base install on all of them, strangely enough it seems to be coming from the "whois" package O_o. Although at one time I'm almost positive it came from the "bsdutils" package.

Last edited by rweaver; 01-07-2009 at 11:39 AM.
 
Old 01-08-2009, 03:39 AM   #38
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Rep: Reputation: 40
Quote:
Originally Posted by rweaver View Post
I've got three systems in front of me that I just checked, it's in my base install on all of them, strangely enough it seems to be coming from the "whois" package O_o. Although at one time I'm almost positive it came from the "bsdutils" package.
I guess I'll have to accept that we simply have to different implementations of mkpasswd, and yours is definately superior.
At least I know where to find yours if I need it later on. Thanks for the help anyway.
 
Old 01-10-2009, 07:41 AM   #39
archtoad6
Senior Member
 
Registered: Oct 2004
Location: Houston, TX (usa)
Distribution: MEPIS, Debian, Knoppix,
Posts: 4,727
Blog Entries: 15

Rep: Reputation: 234Reputation: 234Reputation: 234
FWIW (on SimplyMEPIS 7.0, 32-bit, "official"):
Code:
$ mkpasswd -V
GNU mkpasswd 4.7.20

Copyright (C) 2001-2004 Marco d'Itri
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
rweaver, I'm curious -- what version do you have?

kenneho, I assume that "no -V" means no "--version" or other equivalent.


I do seem to have hashing, but not md5:
Code:
$ mkpasswd -h
Usage: mkpasswd [OPTIONS]... [PASSWORD [SALT]]
Crypts the PASSWORD using crypt(3).

      -H, --hash=TYPE       select hash TYPE
      -S, --salt=SALT       use the specified SALT
      -P, --password-fd=NUM read the password from file descriptor NUM
                            instead of /dev/tty
      -s, --stdin           like --password-fd=0
      -h, --help            display this help and exit
      -V, --version         output version information and exit

If PASSWORD is missing then it is asked interactively.
If no SALT is specified, a random one is generated.
If TYPE is 'help', available algorithms are printed.

Report bugs to <md+whois@linux.it>.
 
Old 01-12-2009, 01:16 AM   #40
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 657

Rep: Reputation: 40
Quote:
Originally Posted by archtoad6 View Post
kenneho, I assume that "no -V" means no "--version" or other equivalent.
That's correct. No version, hash or many other options. :/
 
Old 01-15-2009, 09:06 AM   #41
rweaver
Senior Member
 
Registered: Dec 2008
Location: Louisville, OH
Distribution: Debian, CentOS, Slackware, RHEL, Gentoo
Posts: 1,833

Rep: Reputation: 167Reputation: 167
Quote:
Originally Posted by archtoad6 View Post
rweaver, I'm curious -- what version do you have?
I'm running debian etch presently.

Code:
buttertoast:~# mkpasswd -V
GNU mkpasswd 4.7.20

Copyright (C) 2001-2004 Marco d'Itri
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

buttertoast:~# mkpasswd --help
Usage: mkpasswd [OPTIONS]... [PASSWORD [SALT]]
Crypts the PASSWORD using crypt(3).

      -H, --hash=TYPE       select hash TYPE
      -S, --salt=SALT       use the specified SALT
      -P, --password-fd=NUM read the password from file descriptor NUM
                            instead of /dev/tty
      -s, --stdin           like --password-fd=0
      -h, --help            display this help and exit
      -V, --version         output version information and exit

If PASSWORD is missing then it is asked interactively.
If no SALT is specified, a random one is generated.
If TYPE is 'help', available algorithms are printed.

Report bugs to <md+whois@linux.it>.

Last edited by rweaver; 01-15-2009 at 09:08 AM.
 
  


Reply



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
samba - add user script - User account does not exist itzamecwp Linux - Server 2 01-18-2007 10:52 PM
Add bulk users at a same time mudasar Linux - Networking 1 11-20-2005 01:56 PM
add user script satinet Linux - General 2 10-21-2005 02:48 AM
What add user script you use for Samba 3.0.3-5? subaruwrx Linux - Networking 3 07-19-2004 11:19 AM
add user script? ezra143 Linux - Software 2 10-21-2003 11:21 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:41 AM.

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