Techwarelabs Community

Techwarelabs Community (https://www.techwarelabs.com/community/index.php)
-   Networking (https://www.techwarelabs.com/community/forumdisplay.php?f=10)
-   -   FTP/Linux CHMOD Tips (https://www.techwarelabs.com/community/showthread.php?t=794)

Keefe 06-30-2001 02:27 PM

FTP/Linux CHMOD Tips
 
Chmod is another innocuous but extremely useful Linux command. What does chmod do? Simply put, chmod allows you to change file permissions. For MS-DOS users, it is many ways similar to the "attrib" command, except in many ways it is more flexible and powerful.


Chmod recognizes four classes of users; user [u], group [g], other [o] and all [a]. These distinctions allow you to tailor permissions without having a blanket effect across the entire system, unless you specify it. With chmod you can either allow [+] or deny [-] the ability to run [r], write [w], or execute [x] a file.


Using chmod

The standard syntax is as follows:


chmod [u|g|o|a][+|-][r|w|x] filename



The [u|g|o|a] represent the user specification.
The [+|-] represents whether you wish to allow or deny access.
The [r|w|x] represent the functions you wish to allow or deny.

When you type the command, there is a space between chmod and the commands and a space between the commands and the filename. However, there is no space between the commands.


For example, "chmod go-rw filename" is an example if you what to remove the read and write permissions from the group and other categories.


Absolute setting

Another way to use chmod is through the absolute setting. The absolute setting replaces the commands [u|g|o|a][+|-][r|w|x] with octal numbers. Octal numbers are a numeric system based on eight (hence the octal). Instead of the [u|g|o|a][+|-][r|w|x] commands, you would use the numbers 0-7 to set permissions.

Here are the absolute settings and their permissions.


Setting        Permission

0                  no permission
1                  execute
2                  write only
3                  write and execute
4                  read only
5                  read and execute
6                  read and write
7                  read, write, execute


What about the users, you ask? Instead of using a number of user types, the absolute setting system uses the octal number placement. For example the command:


chmod 012 filename


means:
the user has no permissions (0)
the group has execute permission (1)
other has write-only permission (2)


The order is always the same. The first number will always be the user, the second will be the group, and the final number is other. You must list all three numbers when you use absolute setting syntax.


All times are GMT -5. The time now is 01:04 PM.

Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.