Solved

chmod explain

Posted on 2002-07-04
4
787 Views
Last Modified: 2013-12-27
Hi...i don't really understand how this work.

 i've seen command like ;

  chmod 777 file1
  chmod 666 file1

 i know that the command will
 set certain permission on the file1.
how to use the numbers (654,666,777, etc)?

 tq.

 Sun newbie.
0
Comment
Question by:ismahwati
  • 3
4 Comments
 

Author Comment

by:ismahwati
ID: 7130543
i also have seen command ;

 $ stty erase

 what it do actually.

 tq

0
 
LVL 3

Accepted Solution

by:
UkWizard earned 20 total points
ID: 7130609
Right, firstly chmod;

chmod changes the permissions as you said, it works out to numbers by numbers representing the r ( read ) w ( write ) and x (execute ).
For example; if "ls -al" displays the following;

-rwxr-xrw-  owner  group  size date filename

ignore the first -, this means its a file.
break it down into pairs of three ( rwx ) ie;

rwx r-x rw-  

Where the first block is the file owners permissions.
second is the groups permissions
third is the 'other' permissions

So, The owner ( whatever owner is set to ) has read,write and execute permissions.

Anyone who is in the group ( what the group is set too) has read and execute permissions.

Any other person has read and write permissions.


So, now the numbers thing, each r, w and x represent a number. where r =4, w=2 and x=1.
Now you simpy add the numbers together of the permissions that you require.
So the command "chmod 756 filename" would give the permissions as above ( rwx r-x rw- ) because;

rwx = 4+2+1 = 7   ( owner permissions )
r-x = 4+1   = 5   ( group permissions )
rw- = 4+2   = 6   ( other permissions )

Hope thats clear now, now the 'stty' command

Stty sets/displays the current terminals line settings;

stty erase - sets the erase charactor, see "man stty" for more info.

Enjoy,

UkWizard.

0
 

Author Comment

by:ismahwati
ID: 7136746
tq..that helps
0
 

Author Comment

by:ismahwati
ID: 7136842
sorry ..i forgot to accept the anhwer
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AIX  NFS  question 1 153
remove a combination of patterns from a file 15 71
OpenLDAP Proxy to Active Directy 6 380
How can i set a Environment Variable in my Unix script ? 3 77
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question