• Webconn Technology
    • GPU Server
      • Dedicated GPU Servers with NVIDIA RTX/A100 GPUs for accelerated AI training, rendering, and scientific computing. Features CUDA cores, 24GB-141GB VRAM, and parallel processing. Pre-configured with TensorFlow/PyTorch.

      • nvidia rtx A6000
    • Dedicated Server
      • Experience blazing-fast speeds & ironclad security with your own dedicated server. No shared resources. Fully customizable plans for gaming, e-commerce, and big data. Start now!

      • datacenter
    • Shared Hosting
      • Get user-friendly DirectAdmin shared hosting for your website. Enjoy an intuitive control panel, one-click app installs, and reliable performance. Perfect for blogs, small business sites, and portfolios.

      • shared hosting web
    • Domains
      • Search and register the perfect domain name for your website. Get a memorable .com, .net, .org or niche TLD to start building your brand online. Includes free privacy protection.

      • domain names register
    • VPS
      • Experience the power of a dedicated server without the high cost. Our VPS hosting guarantees CPU, RAM, and storage for your site, ensuring optimal performance and stability.

      • vps hosting
  • Blog
  • Dashboard

How to find files with specific permissions?

Category:
TOC

Overview

You may need to find files with specific permissions in a Linux server for audit and security reasons. You can use the Linux find command to achieve this task.

Solution

The following command can be used to find files with (group or other or both) writable permission and SET UID set.

# find / -perm /022 -and -perm -4000 -exec ls -ldb {} ;
                        ^^^^                       ^
                        | | | |                           |-- So the SUID is 4
                        | | | |-- Other is writable (2)
                        | | |--Group permission is writable (2)
                        | |-- No owner permission mentioned (0)
                       |-- As the logic is OR - group or other or both

You can use the following command to list files with other writable excluding sticky bit sets.

# find / -perm -002 -and -perm -1000 -exec ls -ldb {} ;

Use the following command to list files with other writable excluding sticky bit set.

# find / -perm -002 -not -perm -1000 -exec ls -ldb {} ;

The following command can be used to list files with (group + other) writable and SET GID set.

# find / -perm -2022 -exec ls -ldb {} ;

The Find command to list files with (group + other) writable permission and SET UID set.

# find / -perm -4022 -exec ls -ldb {} ;

Command to list files with other writable and sticky bit sets.

# find / -perm -1002 -exec ls -ldb {} ;

Command to list files with other writable excluding sticky bit set.

# find / -perm -002 -not -perm -1000 -exec ls -ldb {} ;

Leave a Reply