Linux Administrator

How to :- Find Files Using SUID and SGID Permissions in Linux / Debian

In this article, I will explain how we can find files using SUID and SGID permissions in Unix/Debian system. Commonly these permission referred as ” Special Permission” in Linux.

What is SUID and SGID in Linux?

Set Owner User ID (SUID) it is a special file permission in linux given to a file. We can also say that it is temporary permission given to a user to run a specific program or files with specific permissions of the the file owner rather that user who runs it.

Set Group ID (SGID) it is a special file permission in Linux given to a file or folder. In Linux/Unix when a program runs it take access permissions from the logged in user. It is temporary permission to a user to run specific program or file with the specific permissions of the file group permission to be a member of that group to execute the file. So in simple word we can say that user will get file group’s permissions when executing a files.

SGID is similar as SUID. Main difference between both is that SUID is a owner of the file permission and SGID is a group’s permissions when executing a files instead of logged in user inherit permission.

Now let’s find the files which have SUID and SGID set using the find command.

Find Files Using SUID and SGID Permissions

Follow this below syntax:

$ find directory -perm /{permissions}

Note :- Some directories like /etc/, bin, /sbin etc. require root privileges to access the or list. If you are a normal user you should have sudo access.

Find Files suing SUID Permission in Linux

Follow this below command to find the all files with SUID set in the current directory using –perm options for example find the files only with permission set to 4000.

$ find . -perm /4000

You can also use the ls command with –l option to view the permissions on the listed files.

Find Files suing SGID Permission in Linux

Follow this below command to find files with SGID set in current directory.

$ find . -perm /2000

If you want to find both SUID or SGID set file, run the below command:

$ find . -perm /6000

That’s all . In this article I explained how to find files using SUID and SGID in Linux.

Follow my this tutorial to learn about UMASK.

 

Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website www.looklinux.com. To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author

mm

Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment