r/debian • u/saint_hwanii • 7h ago
News adduser 3.159/3.160: new —add-authorized-key option and a fix for duplicate IDs (testers welcome)
I recently made two patches into adduser, and I'd love some testing and feedback.
**adduser 3.159** (now in testing): new `--add-authorized-key` option (Closes: #446362)
It adds an SSH public key to the new user's `~/.ssh/authorized_keys` when the account is created. You can pass a key file or the key itself, and you can repeat the option to add several keys:
sudo adduser --add-authorized-key ~/.ssh/id_ed25519.pub alice
sudo adduser --add-authorized-key "ssh-ed25519 AAAA... bob@laptop" \
--add-authorized-key /tmp/bob_work.pub bob
A few details:
- Keys are appended, so any authorized_keys you ship in /etc/skel is kept.
- It only works for regular users, not with --system.
- If adduser didn't create the home directory (e.g. --no-create-home), it skips the key with a warning and still creates the user.
- Keys aren't validated, so double-check what you paste.
**adduser 3.160** (just uploaded to unstable)
- adduser no longer hands out the same ID twice (Closes: #248500, a long-standing bug)
- The REUSE_IDS and ID_COUNTER_INIT settings are now documented
If you run testing or unstable, please give them a try, especially with key files, multiple keys and custom /etc/skel setups, and report anything odd on the Debian BTS. Questions and comments welcome >.<
