Modify the following fields:
- Change username to the desired username;
- Change usergroup to the desired user group;
- Change userpwd to the user’s home directory;
After renaming the file to <span>user.sh</span>, execute the script.
#!/bin/bash
groupadd -g 1102 usergroup && useradd -u 1102 -g username -d /userpwd -c "userremarks." -m -s /bin/bash username
echo "userpassword" | passwd --stdin username
chown -R username:usergroup /userpwd
chmod -R 755 /userpwd