File System Security, File System

Source: Internet
Author: User

File System Security, File System
Zookeeper

1. Globally readable files
A globally readable file is a file that any user has the permission to view.
Find/-type f-perm-4-print 2>/dev/null

2. Globally Writable Files
Globally writable files are files that all users have the permission to change.
Find/-type f-perm-2-print 2>/dev/null
Find/-type d-perm-2-print 2>/dev/null

3. Special file permissions: setuid and setgid
If the setuid file is set, the user executes the file as the owner of the file, instead of the user who executes the file.
Similar to setgid, it is executed as a file group.
/Etc/shadow is such a file
 
Add setuid permission
Chmod u + x testfile
Chmod u + s testfile
 
Cancel setuid permission
Chmod u-s testfile
 
Add setgid permission
Chmod g + x testfile
Chmod g + s testfile
 
Cancel setgid permission
Chmod g-s testfile

Find the setuid or setgid file in the system.
Find/-perm-4000-print // setuid
Find/-perm-2000-print // setgid

4. No owner File
Find the files without the owner and group in the system.
Find/-nouser-o-nogroup

5. Device Files
The device files are stored in/dev/. Do not set the permission to be globally readable.

6. Disk partitioning
DoS attacks by occupying all the available disk space
Cat/dev/zero>/tmp/bigfile // keep writing 0 to byodps, consuming disk space

Use the Linux disk quota to limit the disk space that each user can use
Partition disks reasonably and Mount important file systems to different disk partitions.

7. Set the grub Password
Generate MD5 encrypted password information
/Sbin/grub-md5-crypt

Change/etc/grub. conf configuration
Password -- md5 xxxxxxxxxxxxxxxxxxxx
Lock
 
Reboot

8. Restrict su Switching
Configure to only allow users in the wheel group to su
Change su command group to wheel
Chgrp wheel/bin/su

Change the su command permission and reject the execution of users except the root and wheel groups.
Chmod u + s, o-rwx, u + rwx, g + rx/bin/su

Add trusted users to the wheel group
Usermod-G wheel sam

9. Use the appropriate mount options
Use noexec \ nosuid \ nodev and other options to better control the mounted file system
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.