Linux provides full control over file access which ultimately helps many people to use the system. Files and data are maintained leaving no risks of them being changed, viewed, modified or deleted.
The Three Types Of Users In Linux Who May Have Access To The Files:
- User – An account created by the administrator of the system for a user to access that system. Accounts may also be created for machine processes, like the mail, FTP, or web server. Users have direct ownership over files and directories on the system.
- Group – Provides the ability to give access to sets of users. Groups have their own permissions over each file or directory.
- World – Anyone else that may attempt to access a file on the machine.
Three Ways In Which These Types Of People Can Access The File:
- Read – Opening a file and looking at its contents.
- Write – Overwrite, append, or delete a file. In directories, this may include creation of files.
- Execute – The ability to “run” a program (or script).
The “most restrictive access” policy is used for granting any kind of permissions as and when needed. No one has access to anything for no reason.
“chmod” (change mode) is a command for managing permissions.
Basic syntax for this command is:
chmod [who][how to change][permissions to modify] [file or directory name]
The “who” can be:
- u – user or account that owns the file
- g – group that owns the file
- o – others, or “world”, anyone else who may access the file
- a – all of the above
The “how to change” can be:
- = (equals) – set the permissions to exactly what immediately follows
- + (add) – add the permission that immediately follows, leave others as-is
- – (minus) – subtract the permission that immediately follows, leave others as they are
The “permissions to modify” can be:
- r – read
- w – write
- x – execute
Changing Owners And Groups:
Two popular commands exist that can be used for modifying the owning user and group of a file. The first is “chown” (change owner).
The syntax for this is:
chown [user]:[group] [file or directory]
Example: We have a file called “systems.lst” and we need to change its owner to a user called xyz who is in the abc group. Then the command is chown xyz:abc systems.lst
Anyone intending to change the group, can use another command called “chgrp” (change group.
The syntax for this command is:
chgrp [group name] [file or directory name]
Example: There is a file called “run.sh” that we want to change to be owned by the abc group. Then the command is chgrp abc run.sh.
Other Linux Commands:
- useradd – add a system user
- userdel – remove a system user
- usermod – modify an existing system user. This can be used to perform several operations on a user’s account.
- groupadd – add a group to the system
- groupdel – remove a group from the system
- groupmod – modify a group
Source : techlila
Latest posts by William Fieldhouse (see all)
- A John McAfee-Backed ICO Exposed Thousands of Peoples Documents Due to Security Blunder - April 26, 2018
- Latest Hacking News Podcast #13 - April 17, 2018
- Latest Hacking News Podcast #12 - April 16, 2018