Linux File Permissions settings

Source: Internet
Author: User
Tags regular expression file permissions least privilege

The three most basic permissions for a file are read and write execution

R, read, can read files, directories can list directories of files listing 4

W, write, can modify delete file, for directory can create delete file 2

X, execute, can execute file, directory can be CD into directory 1

Note: Only execute permissions on the directory, you can enter or cross this folder, but to access files under this folder with Read permissions, you must enter a file name, only the folder that executes the permissions, cannot list directories, and cannot delete the directory

Special bit, suid,sgid,stickt-bit bit, if the SUID executable is set to execute, the file will run as the owner. SGID, meaning the same suid,sticky-bit bit, although other users have write permission, but must be the owner of the delete and move operations. Subdirectories can also only be manipulated by the owner.

Permission Settings command

Chmod,-r, recursion, s means Suid or sgid,t represents Stick-bit,

Chown, changing user owners and groups, R recursion, plus: is to change the group, not add to change the user,

Umask, the default build encoding for a file is the default permission to create a new file,-s to view the default permissions.

Find, finding files,< start directory >< options expression >< conditional matching expression >< Action expression >

An option expression,-follow, that tracks symbolic links when a symbolic link is encountered. -REGEXTYPE Specifies the type of regular expression used by-regex and-iregex,-depth, finds the current directory before looking for subdirectories,-mount, does not cross file systems,-xdev, and-mount,-maxdepth, maximum depth query,

Conditional matching expression,-name matching filename-iname matching filename case-insensitive,-lname matching symbolic link file name,-ilname matching symbol link file name case-insensitive,-path path,-regex, regular match,-iregex, regular match, case-insensitive,-amin n finds all files accessed before n minutes,-atime n searches for files that were accessed before n days,-cmin, and-ctime file status has been modified (such as permissions),-mmin and-mtime are the contents of the file have been modified,-uid N Find UID is n file,-gid, find all files for GID N,-inum, find i-node files,-links N, find hard links to n files,-size N[BCWKMG] Find by size,-perm mode according to permissions,- Perm-mode, according to the least privilege lookup,-anewer file, look for new files that are newer than file access time,-cnewer find files that are newer than Fule,-newer file to find files that have been modified by the new content Fstype the file system of the specified type,-type specifies the file type,-empty content is empty,-user NAME, search by user,-group according to the group,-nouser, file does not belong to the user in/etc/passwd,-nogroup, Files do not belong to groups in/etc/group

Action expression,-print, one file per line,-print0 cancel spacer.

grep [options] pattern [FIFL ...] All the text content, print out the matching lines,-C displays only the number of matches, the-I search is case-insensitive,-n matches the line number of the row,----------------------output unmatched row,-a also displays the N rows following the matched rows,-B matches the previous rows

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.