Techware Labs Header

Forums have moved

See this announcement for more details, or just go directly there.

  #1  
Old 06-30-2001, 02:27 PM
Keefe Keefe is offline
Administrator
 
Join Date: May 2002
Location: Wisconsin
Posts: 2,337
Send a message via ICQ to Keefe Send a message via AIM to Keefe Send a message via MSN to Keefe Send a message via Yahoo to Keefe
Default 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.
__________________
It's crazy I'm thinking, just knowing that the world is round.
-http://www.techwarepc.com/ - The Technology Experts
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:34 AM. Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Forum style by ForumMonkeys.