Linux: Instructions for using file permission commands on Linux

Overview

There are 3 types of people that affect file/dir permissions

User Owner: A single person who owns the file/dir (user owner may be user created the file/dir or granted to certain user)

Group Owner: Single group of users who have access to the file/dir (group owner may be primary group of user owner created the file/dir or granted to certain group)

Other user: Everyone else who is not in the group or the owner

Commands

  • ls: is the basic command used to list detailed content in the current directory
  • Structure of file permission
    • d: directory
    • – (dash): a regular file
    • l: a symbolic link
  • Command change/set permission
  • Identities
    • u: the user who owns the file (the owner)
    • g: the group to which the user belongs
    • o: others (not the owner or the owner’s group)
    • a: everyone or all (u,g and o)
  • Actions
    • + : adds the permission
    • : removes the permission
    • = : makes it the only permission
  • Command change ownership
  • Command set uid permission
  • SUID is a special type of file permissions given to a file. Normally in Linux/Unix when a program runs, it inherit’s access permissions from the logged in user. SUID is defined as giving temporary permission to a user to run a program/file with the permissions of the file owner rather that user who runs it. In simple words users will get file owner’s permissions as well as owner UID and GID when executing a file/program/command
  • Command set gid permission
  • Setgid on a directory means that files created in the directory will inherit the group affiliation from the directory, rather than inheriting it from the creating user. This is commonly used on group collaborative directories to automatically change a file from the default private group to the shared group
  • Command set Sticky Bit
  • The sticky bit for a directory sets a special restriction on deletion of files: Only the owner of the file (and root) can delete files within the directory
  • Command set umask
  • It’s permission set default when we are create file or directory
    • By default of file is 666 (rw-rw-rw-)
    • By default of directory is 777 ( rwx rwx rwx)

** If you have difficulty in configuring Sophos products in Viet Nam, please contact us:

Hotline: 02862711677

Email: info@thegioifirewall.com

Be the first to comment

Leave a Reply

Your email address will not be published.


*