Skip to Main Content
Hands-On System Programming with Linux
book

Hands-On System Programming with Linux

by Kaiwan N. Billimoria, Tigran Aivazian
October 2018
Beginner content levelBeginner
794 pages
19h 23m
English
Packt Publishing
Content preview from Hands-On System Programming with Linux

setgid example – wall

As a great example of setgid binaries, take a look at the wall(1) utility, reproduced from the script's output for convenience:

-rwxr-sr-x 1 root tty        30792 Aug 14  2017 wall

The wall(1) program is used to broadcast any message to all users console (tty) devices (typically the sysad will do this). Now, to write to a tty device (recall, folks, Chapter 1, Linux System Architecture, and the if it's not a process, it's a file Unix philosophy), what permissions do we require? Let's take the second terminal tty2 device as an example:

$ ls -l /dev/tty2crw--w---- 1 root tty 4, 2 Feb 19 18:04 /dev/tty2$ 

We can see that to write to the preceding device we either require root or we must be a member of the tty group. Peek again at ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux System Programming Techniques

Linux System Programming Techniques

Jack-Benny Persson
Linux Device Drivers, Second Edition

Linux Device Drivers, Second Edition

Jonathan Corbet, Alessandro Rubini

Publisher Resources

ISBN: 9781788998475Supplemental Content