Linuxlab

Users and permissions

Linux is multi-user: every file has an owner and a group, and the rwx permissions decide who may do what. In this lesson you create a user, add them to a group, and hand out permissions on a shared file. These commands need root, so write sudo - in the sandbox it needs no password. The devs group and the file /srv/shared/notes.txt already exist.

Steps

1. A new user

useradd -m creates a user together with a home directory.

sudo useradd -m alice
id alice

2. Group membership

Add alice to devs. The -aG flag means add (a) to groups (G) without touching the rest. Forget -a and you drop the user from every other group.

Locked

The rest of this lesson is part of a paid course

You are reading the open part. Buy the course to unlock the whole lesson and its lab.

See the course