Solved

chmod explain

Posted on 2002-07-04
4
779 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

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sort command HPUX 11 76
Java core in Solaris 10 1 283
aix tls version 6 318
Can I delete authorized_keys in FreeBSD 1 88
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…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

803 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