Special File Permissions in Linux

All you need to know about SetUID, SetGID and Sticky Bit

Sahitya Maruvada
Jul 2, 2020 · 4 min read

Introduction:

SUID:

$ ls -la /usr/bin/passwd
-rwsr-xr-x 1 root root 63736 Jul 27 2018 /usr/bin/passwd
$ ls -la /usr/bin/test
-rwxr-xr-x 1 root root 63736 Jul 1 2020 /usr/bin/test
# setting with symbolic arguments
$ chmod u+s /usr/bin/test
# setting with bit representation
$ chmod 4755 /usr/bin/test

SGID:

$ ls -la test_dir
drwxrwsr-x. 2 test support_users 4096 Nov 1 17:25 test_dir
$ ls -la /home/test/sgid_dir
drwxrwxr-x 5 test support_users 360 Jun 29 15:46 sgid_dir
# setting with symbolic representation
$ chmod g+s /home/test/sgid_dir
# setting with bit notation
$ chmod 2775 /home/test/sgid_dir

Sticky Bit:

$ ls -la /tmp
drwxrwxrwt 1 root root 4096 Jun 14 02:59 tmp
$ ls -al test
drwxrwxr-x 5 test support_users 360 Jun 29 15:46 test
# Symbolic Representation
$ chmod o+t test
# Bit Representation
$ chmod 1775 test

Takeaways:

Limitations:

100 Days of Linux

All about exploring Cool Linux features!!

Sahitya Maruvada

Written by

Tech and Travel Enthusiast!! Software Engineer by profession!! Writing on Medium is my way of giving back to the dev community 😃

100 Days of Linux

Linux is a ubiquitous Operating System. It has so many useful features. This publication is all about Linux and its tools. It will also include articles about Linux Networking Stack.

Sahitya Maruvada

Written by

Tech and Travel Enthusiast!! Software Engineer by profession!! Writing on Medium is my way of giving back to the dev community 😃

100 Days of Linux

Linux is a ubiquitous Operating System. It has so many useful features. This publication is all about Linux and its tools. It will also include articles about Linux Networking Stack.

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store