Skip to content

Instantly share code, notes, and snippets.

@ajgappmark
Created August 30, 2023 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajgappmark/018b4308ec5ed43bedd48497215569a7 to your computer and use it in GitHub Desktop.
Save ajgappmark/018b4308ec5ed43bedd48497215569a7 to your computer and use it in GitHub Desktop.
create new user with specified credentials for limited time and add him to a desired group
USERNAME="johndoe"
PASSWD="xxxxxxxx"
FULLNAME="John Doe"
sudo useradd ${USERNAME} -b /home/hackathon -m -s /bin/bash -e 2023-09-02 -c "${FULLNAME} - guest user for hackathon" && \
echo $USERNAME, ${FULLNAME} " created!"
echo "${USERNAME}:${PASSWD}" | sudo chpasswd && \
echo "password set for ${USERNAME}"
sudo usermod -a -G grphackt ${USERNAME} && \
echo "user added to shared group"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment