On other Linux distribution such as ArchLinux, Fedora, CentOS, openSUSE, etc. Note: mkpasswd binary is installed via the package whois on Debian / Ubuntu only. Both examples are using $6$ which denotes that you want crypt to use SHA-512.Īll examples will be using SHA-512, as password placeholder and as salt placeholder. In these examples the password is the string "password" and the salt is "saltsalt". Perl $ perl -e 'print crypt("password","\$6\$saltsalt\$"). Support for this method of specifying the algorithm is dependent on support in OS level crypt(3) library function (usually in libcrypt). $6$saltsalt$qFmFH.bQmmtXzyBY0s9v7Oicd2z4XSIecDzlB5KiA2/jctKu9YterLp8wwnSq.qc.eoxqOmSuNp2xS0kt元nh/ Python (2.x or 3.x) $ python -c "import crypt, getpass, pwd \ or scripted- $ python -c 'import crypt print(crypt.crypt("somesecret", crypt.mksalt(crypt.METHOD_SHA512)))' Take note that these are salted: Python (>= 3.3) $ python -c 'import crypt,getpass print(crypt.crypt(getpass.getpass(), crypt.mksalt(crypt.METHOD_SHA512)))' To work around this you can use the following Python or Perl one-liners to generate SHA-512 passwords. $ yum whatprovides "*/mkpasswd"īoth of these methods are superior to using rpm since the packages do not have to be installed to locate */mkpasswd. You can find out what package it belongs to with either of these commands. NOTE: The command mkpasswd is actually part of the expect package, and should probably be avoided. On any of the Red Hat distros such as Fedora, CentOS, or RHEL the command mkpasswd doesn't include the same set of switches as the version typically included with Debian/Ubuntu.
0 Comments
Leave a Reply. |