Linux User Management - Hands-on for Student User
1. Create a User for a Student
To create a new user, use the useradd command with the -m option to create a home directory.
sudo useradd -m student2. Assign a Password to the User
Set a password for the newly created user:
sudo passwd studentYou will be prompted to enter and confirm the new password.
3. Change Ownership of Files to the User
If there are files that need to be owned by the student user, use the chown command:
sudo chown -R student:student /path/to/filesFor example, if there is a directory /home/shared_docs that should belong to student:
sudo chown -R student:student /home/shared_docs4. Verify the Changes
Check the ownership of the files:
ls -l /home/shared_docsCheck the user's details:
id studentNow the student user has been created, assigned a password, and given ownership of the specified files. 🚀