Skip to content

Instantly share code, notes, and snippets.

@jberger
Last active May 9, 2024 17:54
Show Gist options
  • Save jberger/eb681a0ce924c4223b0f0e4210d7751a to your computer and use it in GitHub Desktop.
Save jberger/eb681a0ce924c4223b0f0e4210d7751a to your computer and use it in GitHub Desktop.
Create User Without Password
# create user with a disabled password
adduser myusername --disabled-password
# optionally login as them and create authorized_keys
# su - myusername
# mkdir --mode=0700 .ssh
# echo 'key' > .ssh/authorized_keys
# chmod 0600 .ssh/authorized_keys
# ^d
# optionally add them to a group, like sudo
# adduser myusername sudo
# delete the disabled password
passwd -d myusername
# force an immediate password set
chage -d 0 myusername
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment