Pues eso, a veces queremos cambiar la clave y ejecutamos el comando siguiente
root@edbsrv1 /etc/edb/edb-pgpool43 16:53:12 # passwd pad New password: Retype new password: passwd: password updated successfully root@edbsrv1 /etc/edb/edb-pgpool43 16:53:23 #
Pero existe otra manera de que en una sola línea podamos asignar la clave al usuario. De esa forma se torna el proceso mas rápido y libre de un error de escritura. Esto es haciendo uso del parámetro –stdin y con la ayuda del comando echo de la siguiente forma
root@pgmaster ~ 16:56:36 # echo "nuevaclave" | passwd --stdin pad Changing password for user pad. passwd: all authentication tokens updated successfully. root@pgmaster ~ 16:58:34 #
A tener en cuenta, en algunas distribuciones como Debian 10, NO funciona, nos sale este mensaje de error
root@edbsrv1 /etc/edb/edb-pgpool43 16:53:23 # echo "nuevaclave" | passwd --stdin pad
passwd: unrecognized option '--stdin'
Usage: passwd [options] [LOGIN]
Options:
-a, --all report password status on all accounts
-d, --delete delete the password for the named account
-e, --expire force expire the password for the named account
-h, --help display this help message and exit
-k, --keep-tokens change password only if expired
-i, --inactive INACTIVE set password inactive after expiration
to INACTIVE
-l, --lock lock the password of the named account
-n, --mindays MIN_DAYS set minimum number of days before password
change to MIN_DAYS
-q, --quiet quiet mode
-r, --repository REPOSITORY change password in REPOSITORY repository
-R, --root CHROOT_DIR directory to chroot into
-S, --status report password status on the named account
-u, --unlock unlock the password of the named account
-w, --warndays WARN_DAYS set expiration warning days to WARN_DAYS
-x, --maxdays MAX_DAYS set maximum number of days before password
change to MAX_DAYS
root@edbsrv1 /etc/edb/edb-pgpool43 16:54:59 #
Para solventar esto, ejecutamos el siguiente comando y con eso solucionamos el impase.
root@edbsrv1 /etc/edb/edb-pgpool43 16:57:49 # echo -e "nuevaclave\nnuevaclave" | passwd pad New password: Retype new password: passwd: password updated successfully root@edbsrv1 /etc/edb/edb-pgpool43 16:58:12 #
Ojo con el \n en la clave, ello nos permite introducir el salto de línea.
Saludos…