Red_Hat
RH302 · Question #167
Add a user named user4 who primarily belongs to the training group. The user account should be configured to expire 30 days from the current date.
Create the training group if it doesn't exist sudo groupadd training sudo useradd -g training user4 sudo passwd user4 <<EOF MySecurePassword123 MySecurePassword123 EOF Calculate the expiration date 30 days from now EXPIRATION_DATE=$(date -d "+30 days" +%Y-%m-%d) sudo usermod -e "
System configuration
Question
Add a user named
user4 who primarily belongs to the training group. The user account should be configured to expire 30 days from the current date.Explanation
Create the training group if it doesn't exist
sudo groupadd training
sudo useradd -g training user4 sudo passwd user4 <<EOF MySecurePassword123 MySecurePassword123 EOF
Calculate the expiration date 30 days from now
EXPIRATION_DATE=$(date -d "+30 days" +%Y-%m-%d) sudo usermod -e "$EXPIRATION_DATE" user4
Verify the account expiration date
sudo chage -l user4
Topics
#user management#group membership#account expiry#chage
Community Discussion
No community discussion yet for this question.