You either use those commands or manually add your user to /etc/passwd
and its password to /etc/shadow
.
Format of a /etc/passwd
entry: username:passwd:UID:GID:full_name:directory:shell
Passwd should be x if you want it o make it secure, so it will read from shadow.
Format of a /etc/shadow
entry: username:passwd:last:may:must:warn:expire:disable:reserved
If you add them correctly, there will be no problem.
But why would you bother with it manually while you have the required tool? If you are concerned about the privacy, you can issue mkpasswd -m des --stdin
which will read the password from standart input. Instead of exec, when you use spawn
, you can also control the stdin
and stdout
of the processes. stdin
is just a writable stream, you can write to it and read the output from stdout
. Or you can find a npm module that generates the hash with given algorithms, DES, AES etc.