Linux Labs

Users, permissions, and processes / Stage 8 of 13

Delegating commands with sudo

Not running Starting usually ~20 s
Leave the lesson

Step 3 of 8 · on a machine · 6 min

Syntax and meaning

Rules are edited with visudo: it checks the grammar before saving the file. sudo visudo -cf file checks a finished file without changing anything.

A colleague sent a draft rule for labops and says it passed the check. The requirement is the same: the engineer reads the last two lines of one log.

Exercise · look

Check the draft rule

Read the draft rule and check its syntax. The draft lies outside /etc/sudoers.d and affects nothing; do not install it.

First, predict

What will sudo visudo -cf /srv/sudo-lab/candidate say about the draft?

Now start the exercise, run the command and compare your prediction with the output.

Sign in and start The machine is available after signing in

parsed OK means one thing: the line follows the grammar. What it allows, visudo does not judge. The draft has ALL in the command position, and such a rule would give labops any command as root without a password. You check a rule's meaning by eye, against the table above, and with calls made as the grantee.

Ubuntu 24.04
Loading…