Linux Linux help

Updated: 3 May 2021

User Accounts and Permissions

1. How do I setup User Accounts in Linux?

In Linux Mint, go to Administration and click on Users and Groups. You can create Custom, Administration or Desktop User accounts.
If using the command line, you can use the adduser or addgroup commands to create users and groups. User information is stored in /etc/passwd and group information is stored in /etc/group file.

2. What is an Administrator user?

An administrator account can change any settings on the computer, install drivers, install programs, change file/folder permissions, change system settings and so on.
In the command line, you can use the usermod command with the --groups option and add the user to the adm, sudo groups and others.

3. What is a Desktop User?

A desktop user make make changes in their own account such as desktop appearance, themes, create icons on their desktop, run programs and load and save files. They cannot install drivers, install programs or make system wide changes.,

4. How do I set Folder Permissions in Linux?

To set permissions in Linux right click the folder and select Properties and click on the Permissions tab which shows the current file and folder permissions:

Folder permissions

Linux permissions are split into three areas: Owner, Group and others. Each have their own permisson settings.

Create and delete files - allows full access to read, write, create and delete files.
Access files - allows users to list and read files only.
List files only - allows users to view files not read them.
-- - No access or not applicable rights.

File permissions.

File permissions

Linux permissions are split into three areas: Owner, Group and others. Each have their own permisson settings.

Read and write - User has full read, write, create and delete permissions.
Read-only - User can only read rights and cannot create,write or delete files.
-- - No Access
Execute - User can execute programs and scripts.

To change permissions on the command line, you can use the chmod (change file mode bits) which allow you to set permissions on owner (u), file's group (g), other users (o) or all users (a) by setting the following file bits: read (r), write (w), execute (x, X), set user or group id on execution (e) or restricted deleted flag (t).
To change the user owner of a file or folder, use chown command e.g. chown <username> <folder>.

By changing the group and access rights of a folder or file, you can give permissions to other users.
First change the group owner of the file or folder, using the file or folder properties, or use chown, with the name of the group (preceeded by a colon), and the name of the folder or file.
e.g. chown :<group> <folder> , <chown> <user> <folder> or <chown> <user>:<group> <folder>
Then change the group permissions or access for that group, e.g. chmod g+rw <folder> = change group (g) rights to read and write (rw) for the folder.


5. How do I delete old user accounts and profiles?

User accounts can be deleted from the Users and Groups administration tool.
On the command line, user accounts and files can be deleted with the userdel command. Groups can be deleted with the groupdel command.

6. How do I change my user's or another user's password?

You can change password either by the Users and Groups administration tool or use the passwd command to change password for the current user or for another account.

7. I can not log in to Linux, I have forgotten my password?

You can boot to the GRUB loader menu by pressing and holding the shift key when it boot. Press ESC at the GRUB prompt. Enter e to edit the boot and select the line starting with kernel and add the following after it rw init=/bin/bash to enable read/write and start a bash shell. Then press Enter and b to boot, when the shell opens, enter passwd username to change user's password.

8. Can I enable auto-login on Linux, if I'm the only user?

Yes, by default the password will be set to 'Asked on login' in the Users and Groups administration tool. Change the setting to 'Don't ask for password on login' and make sure the Current password is entered.

9. How do I list which groups I am (or other users) a member of?

If you open Manage Groups, you will list all the available groups. Clicking on Properties will list the members of that group. For example, below Peter is a member of the cdrom group.

In the bash shell, you can run groups [username] to list groups that the username is a member of.
Groups cannot be members of other groups, but multiple users can be members of a group.

peter : peter adm cdrom sudo dip plugdev lpadmin sambashare.

10. How do I give special permissions to users without giving them full sudo access?

Sudo users have full access to the system, groups can be given permissions to specific filesystems and so on. You can use the sudo.conf file to apply special rights to users or groups, for example, you want to give a user e.g. bill, rights to shutdown or reboot the server but nothing else. Normally, you need sudo rights as the shutdown command is in /sbin. Instead you can configure users with rights in the /etc/sudoers file, this file should not be modified directly but use sudo visudo so any changes can be verified. If you make a mistake, enter e (edit) to edit the file again at the What now? prompt.
joe ALL=(root) /sbin/shutdown

Allows the user joe to run it from any host or ip (ALL), as user root, and run the command /sbin/shutdown. A password prompt is required before shutdown can be run, if no password is wanted, then add NOPASSWD: in front of /sbin/shutdown.