Create users and groups and manage file permissions on Unix systems.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Class: Users, Groups and Permissions

Servers and Tools

In this class you'll learn how to create users and groups on the Ubuntu Linux operating system. The concepts will apply to most Unix-flavor systems including Linux and Mac. We'll be using a Linux operating system called Ubuntu. You'll see how file and directory permissions work and how you can change ownership and permissions using the chown and chmod commands.

What's in this class?

  • Introduction: Managing Users, Groups and File Permissions - Whether you're changing permissions of files on your own machines, or managing a full blown deployment server, understanding how to manage users, groups and permissions is a key skill.

  • Setup with Ubuntu - Install VirtualBox and Vagrant and boot up the Ubuntu virtual machine to follow along with the class.

  • Introduction to Users and Groups - We'll start with the 'whoami' and 'id' commands to find out the current user's id and group membership. Then we'll explore the /etc/passwd and /etc/group files to see how Ubuntu stores this information. Finally we'll look at the /home directory to see where our user's home folder is located.

  • The sudo Command - Let's say you want to write a file in a directory owned by the root user. The only way to do this is to either be logged in as the root user or to escalate your user's privileges using the sudo command. Learn how the sudo command works, explore the /etc/sudoers.d file and see how to add users to the sudo group.

  • Creating Users - Use the adduser command to create a new user with their own home directory. Then we'll add the user to the sudo group to allow root privileges.

  • Creating Groups - We can use groups to simplify granting permissions to more than one user. In this video we'll create the 'web' group which will eventually own a deployment directory. Then we can add users to the group using the usermod -aG command to give them access to the folder. You'll also see how to remove users from a group using the deluser command.

  • File and Directory Permissions - In this video we'll make a new folder named /srv/www. Then we'll explore the permission bits for the folder and a new file we create. You'll learn about the owner and group and the three permission bits: read, write and execute. You'll also see two additional permission types: 's' and 't' which are the setuid/setgid and the sticky bit respectively. Finally, you'll see how these permissions can be represented as octal numbers.

  • The chown and chmod Commands - We'll start off by using the chown command to change the owner of the /srv/www folder. Then you'll see two different ways to use the chmod command to add and remove file permissions using letters or octal numbers.