How to grant permissions to a regular Linux user?
To grant permission to regular users in a Linux system, you can use the following command:
- To add a user: Start by using the adduser or useradd command to create a new user. For example, sudo adduser username.
- Create password: Use the passwd command to set a password for a new user. For example, sudo passwd username.
- Authorized user: Users can be granted authorization by adding them to the appropriate user group or by directly giving them specific permissions.
- Add a user to a user group by using the command usermod -aG groupname username. For example, sudo usermod -aG sudo username adds the user to the sudo group to gain administrator privileges.
- Directly authorize users: You can grant a user permission to read and write to a specific directory or file using the chmod command. For example, sudo chmod u+rwx /path/to/directory grants read and write permissions to the directory for the user.
- To verify authorization, you can use the command “groups username” to see the user’s groups and “ls -l” to check the permissions of directories or files.
This way, regular users in the Linux system can be successfully authorized.