Last active
May 9, 2024 17:54
-
-
Save jberger/eb681a0ce924c4223b0f0e4210d7751a to your computer and use it in GitHub Desktop.
Create User Without Password
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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