PAM Authentication for admin created user

Password for newly created user,

Currently, I am using jupyterHub for multi-user. Where I am creating a new user using admin user in Jupyter Hub.

What is the password for the newly created user? Or is there is any way to create a password for admin created user?

Hi there, I did some digging in the code and it looks like, by default, the password for the account is disabled.

When a user is created, it runs whatever is in c.LocalAuthenticator.add_user_cmd, which on linux defaults to ['adduser', '-q', '--gecos', '""', '--disabled-password'] with the username added as the last argument (it will also replace any instance of "USERNAME" in the list with the username).

As this is being executed as a single process, you won’t be able to chain commands together to set a password unless you launch a script or a shell with a command (I wouldn’t suggest this due to complexity). There doesn’t seem to be a good way to set the password via adducer, so I would suggest using a script to create users.

Something like the following should set the account password to the reverse of the username

#!/usr/bin/env bash

adduser -q --gecos "" --disabled-password "${1}"

echo "${1}" | rev | passwd --stdin "${1}"

Save this script wherever you’d like (I usually use /opt) and set c.LocalAuthenticator.add_user_cmd to ['/path/to/script'] and it should work!