Quantcast
Channel: Oracle Bloggers
Viewing all articles
Browse latest Browse all 19780

Generating a crypt_sha256 hash from the CLI

$
0
0

When doing a completely hands of Solaris installation the System Configuration profile needs to contain the hash for the root password, and the optional inital non root user.

Unfortunately Solaris doesn't currently provide a simple to use command for generating these hashes, but with a very simple bit of Python you can easily create them:

#!/usr/bin/python

import crypt, getpass, os, binascii

if __name__ == "__main__":
    cleartext = getpass.getpass()
    salt = '$5$' + binascii.b2a_base64(os.urandom(8)).rstrip() + '$'

    print crypt.crypt(cleartext, salt)



                       

Viewing all articles
Browse latest Browse all 19780

Trending Articles