Working with Special Bits

15 minutes
  • 3 Learning Objectives

About this Hands-on Lab

While they don’t come up very often, it’s important to know how to manage the special bits that can be set on files and directories. This lab will walk through some of the ways to manage them.

Learning Objectives

Successfully complete this lab by achieving the following learning objectives:

Create the Collaborative Area

First, we need to create the directory:

mkdir /opt/managers

Then we set it so that all new files created will be owned by the managers group:

chmod g+s /opt/managers

Create a Scratch Area, Similar to /tmp, Named scratch

First create the directory:

mkdir /opt/managers/scratch

Then set permissions:

chmod 777 /opt/managers/scratch

Then set the Sticky Bit:

chmod o+t /opt/managers/scratch

Configure the suid Executable

First we need to copy the executable:

cp /tmp/suid /opt/managers

Then set ownership:

chown bob.managers /opt/managers/suid

And finally we set the setUID bit:

chmod u+s /opt/managers/suid

Additional Resources

We've been tasked with setting up a space for different managers to collaborate. Bob, Adam, and Sally all have user accounts on the server, and are members of the managers group.

In the /opt directory, create a directory for them to work in named managers. Make sure that all files created in there are owned by the managers group.

Inside that directory they'd like a scratch directory set up (sort of a dumping area for temporary files, similar to the /tmp directory), named scratch.

In addition, there's an executable in /tmp named suid that needs to be owned by bob and run with his permissions any time anyone runs it.

What are Hands-on Labs

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Sign In
Welcome Back!

Psst…this one if you’ve been moved to ACG!

Get Started
Who’s going to be learning?