Last active
June 8, 2020 02:35
-
-
Save scsibug/0dfa8d7474ccaf2fe17d506b50ed9fd7 to your computer and use it in GitHub Desktop.
Linux Service Account Creation
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
useradd username \ | |
--system \ | |
--shell /bin/nologin \ | |
--comment "Description of account" \ | |
--expiredate 1 # block all authentication \ | |
--create-home # or --no-create-home \ | |
--home /home/dir | |
# Or, short version (w/ home directory) | |
useradd username -r -s /bin/nologin -c "description" -e 1 -m -d /home/dir | |
# No home directory | |
useradd username -r -s /bin/nologin -c "description" -e 1 -M | |
# Resulting entry in /etc/passwd | |
username:x:998:997:Description of account:/home/username:/bin/nologin | |
# Resulting entry in /etc/shadow (password already locked) | |
username:!:18420:::::: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment