Mkpasswd -m sha-512 password

  • system: "x86_64-linux"
  • host os: Linux 5.19.9, NixOS, 22.05 (Quokka), 22.05.3242.72783a2d0db
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Nix) 2.8.1
  • channels(root): "home-manager-22.05.tar.gz, nixos-22.05, nixos-hardware"
  • channels(usera): ""
  • nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos
mkpasswd -m sha-512 password

How to use it currently ?


mkpasswd -m sha-512 password_ZZ_11_*
usage: mkpasswd [args] [user]
  where arguments are:
    -l #      (length of password, default = 9)
    -d #      (min # of digits, default = 2)
    -c #      (min # of lowercase chars, default = 2)
    -C #      (min # of uppercase chars, default = 2)
    -s #      (min # of special chars, default = 1)
    -v        (verbose, show passwd interaction)
    -p prog   (program to set password, default = passwd)

user name does not work either


old 22.05 config/hash is not working in 22.11

Seems to work for me:

$ mkpasswd -m sha-256 'secret_passw*rd'
$5$fdx2qFKZTY5l8RGc$XhIK.ifraStCJXF78xEu2ntjw2iDn/PU98fFzYPMyi.

Though seems as if you missed to quote/escape the asterisk, so it got interpreted as a glob by your shell.

You didn’t escape the * from the shell. That’s probably your issue.

I recommend not supplying the password as an argument, though, as that puts it in your shell history. Just do mkpasswd -m sha-512, and type in your new password at the prompt.

3 Likes
mkpasswd -m sha-512
usage: mkpasswd [args] [user]
  where arguments are:
    -l #      (length of password, default = 9)
    -d #      (min # of digits, default = 2)
    -c #      (min # of lowercase chars, default = 2)
    -C #      (min # of uppercase chars, default = 2)
    -s #      (min # of special chars, default = 1)
    -v        (verbose, show passwd interaction)
    -p prog   (program to set password, default = passwd)

mkpasswd -m sha-256 'secret_passw*rd'
usage: mkpasswd [args] [user]
  where arguments are:
    -l #      (length of password, default = 9)
    -d #      (min # of digits, default = 2)
    -c #      (min # of lowercase chars, default = 2)
    -C #      (min # of uppercase chars, default = 2)
    -s #      (min # of special chars, default = 1)
    -v        (verbose, show passwd interaction)
    -p prog   (program to set password, default = passwd)

Huh… I don’t think you’re using the right mkpasswd. Mine works completely differently than that usage text suggests. What package is it coming from? It should be pkgs.mkpasswd.

$ nix shell nixpkgs\#expect -c mkpasswd -m sha-512
usage: mkpasswd [args] [user]
  where arguments are:
    -l #      (length of password, default = 9)
    -d #      (min # of digits, default = 2)
    -c #      (min # of lowercase chars, default = 2)
    -C #      (min # of uppercase chars, default = 2)
    -s #      (min # of special chars, default = 1)
    -v        (verbose, show passwd interaction)
    -p prog   (program to set password, default = passwd)

looks like yours is coming from pkgs.expect.

1 Like

looks like you are right
(Now I have see if I get a nixos-rebuild without to lose the Nix-Channels in the paths … to have a working OS … mh, no first I have to get rid of Home-Manager which destroyed-OS my Laptop already …)