|
Software -
Common software
|
|
Tuesday, 29 April 2008 20:59 |
|
Linux is a multi user system. To secure files access in this multi user environment many file systems in Linux implements file rights. Bellow is a short presentation of the Linux file access control system using file rights, users and groups: - Each Linux user belongs to a group
- Each file in Linux belongs to a specific user
- Each file in Linux has three sets of access rights attached to it, one for user, one for group and one for the rest of users and groups in the system (world)
- Each set of access rights defines the permitted access to the file: read, write and/or execute
- The set of rights for the user applies to the user that owns the file
- The set of rights for the group applies to the users belonging to the same group as the file owner
- The set of rights for the world applies to any users not belonging to the same group as the file owner
- The rights a user, group or world can have on a file or directory are read, write and execute - in a directory case execute means list contents
- Some command line utilities in Linux that works with file rights uses a numeric representation consisting of a three digit number for the file rights. The format of this number is explained in the next lines:
- Each digit represents a set of right
- 4 stands for read, 2 stands for write and 1 stands for execute
- The 4, 2 and 1 values can be combined using bit OR operator to obtain any combination of rights needed (e.g. 6 stands for read write, 3 stands for write and execute and 7 stands for read, write and execute
To visualize the files and directories rights in Linux the ls command can be used in the following way: To alter file rights in Linux the chmod command is used. Below are some usage examples for the chmod command: - chmod 777 file_name - gives everybody permission to read, write and execute the file specified by file_name
- chmod -R 777 folder_name - sets read, write and execute/list contents permission for everybody for the directory specified by folder_name and its subdirectories
To change the owner of a file or a folder the chown command should be used. Below are some usgage exeamples for the chown command: - chown user:group file_name - changes the owner of the file_name file to the user/group combination represented by the user and group parameters
- chown -R user:group folder_name - changes the owner of the directory specified by folder_name and all its subdirectories to the user/group combination represented by the user and group parameters
This article is only a short introduction in rigths management in linux. For more detalis please consult the manual for chown and chmod commands.
|
|
Last Updated ( Sunday, 11 May 2008 23:18 )
|