There's no real interface to the crypt() syscall through Bash that I know of, however if you've got either perl or mysql command line you can do something like:
mysql -u <user> -h <host> -p <database> -e 'select encrypt("passwd", "$1$salt")'  The $1$ specifies that it use MD5 if available. Remove this if you compiled on a system that doesn't support md5, since vpopmail won't use md5 either then. To find out if you're using md5, simply look at the password string of one of the existing accoutns, and if it begins with $1$ then you're using md5, otherwise its DES.
You can also do
perl -e 'print crypt("password", "$1$salt");'  The same rules apply to the string being used as a salt.
For more info see the MySQL manual available at www.mysql.com, or for the perl function see perldoc -f crypt.
Hope that helps,
Nick Harring
Webley Systems
Oliver Etzel - GoodnGo.COM (R) wrote:
Hello,

anybody here who knows how to generate a password that  are stored by
vpopmail in a sql database by a Unix commandline?

Oliver





  
I don't remember exactly, but there is a function in mysql SQL
that allows you to create a unix compatible MD5 password
from the clear text.

>From mysql documentation:
ENCRYPT(str[,salt])

Encrypt str using the Unix crypt() system call. The salt argument
    
should be a
  
string with two characters. (As of MySQL Version 3.22.16, salt may
    
be longer
  
than two characters.)

mysql> SELECT ENCRYPT("hello");
        -> 'VxuFAJXVARROc'

On Tuesday 28 October 2003 10:36 am, Oliver Etzel - GoodnGo.COM
    
\(R\) wrote:
  
Hello Peter, hello all,

you wrote, that passwords are stored by vpopmail in a sql database
      
by
  
"..It's system crypt(3) function.."

 How can I generate it by a linux commandline?

Oliver

      
Hello Jacob,

On Tuesday, October 28, 2003 at 3:43:41 AM you wrote (at least
        
in
  
part):
        
what style of encryption does vpopmail implement on the
            
passwords
  
that it

      
stores in the sql db?
            
The same it uses for .cdb files. Read the archive [1].

http://bluedot.net/mail/archive/list.php?f=2

          
ITS MD5 by default
            
What "ITS MD5"??? It's system crypt(3) function by default.
And this one uses a MD5-based algorithm instead of "simple" DES
        
if
  
available and indicated by the chosen salt.

But all this /is written down in the lists archive/. Guess why I
advised to read it ...
--
Best regards
Peter Palmreuther

Virginity is curable if detected early.
        


    

  

Reply via email to