Skip to main content

Raymii.org Logo (IEC resistor symbol)logo

Quis custodiet ipsos custodes?
Home | About | All pages | RSS Feed | Gopher

Create /etc/shadow crypted password entries

Published: 23-09-2016 | Author: Remy van Elst | Text only version of this article


Table of Contents


These small snippets create password strings you can put in /etc/shadow whenyou need to reset a password on a system.

If you like this article, consider sponsoring me by trying out a Digital OceanVPS. With this link you'll get $100 credit for 60 days). (referral link)

Perl

perl -e 'print crypt("password","\$6\$salt\$") . "\n"'

Replace password with the password, and salt with the salt. Need some randomstuff for the salt? openssl helps:

openssl rand -base64 10 iDaorRK/57YZfQ==

mkpasswd

On Ubuntu/Debian, install the whois package. On Arch, install debian-whois-mkpasswd from the AUR.

mkpasswd -m sha-512 password salt

OpenSSL

If you need an older style crypt password you can use OpenSSL:

openssl passwd -1 -salt salt password
Tags: crypt, mkpasswd, perl, shadow, snippets, whois