Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
08-13-2002, 04:41 AM
|
#1
|
Member
Registered: May 2002
Location: Wales
Distribution: Slack 8.1, Gentoo 1.3a, Red Hat 7.3, Red Hat 7.2, Manrake 8.2
Posts: 328
Rep:
|
chmod
Hi all Im starting to get to grips with some of the bash commands now and was wondering if somebody could let me know if this assumption is correct.....
when using chmod if you specify a 7 (whether for user other users or other groups) it gives read write and execute access
a 6 would give read(4) write(2) access but no execute priveleges
a 5 would give read and execute(1)
a 4 would give read only
a 2 write only
and a 1 execute only
so chmod 751 would give the user full priveleges the other users in the same group read and execute priveleges and other groups execute only priveleges.
Am I correct in my assumptions???
Last edited by dai; 08-13-2002 at 04:51 AM.
|
|
|
08-13-2002, 05:00 AM
|
#2
|
Member
Registered: Jun 2002
Location: Kanpur,India
Distribution: RH-7.0 , 7.3
Posts: 130
Rep:
|
yeah your conclusions are correct  ....change the number 7
in binary : 7=111 ....compare it with rwx (Read-Write-eXecute)...
1 at all places means all access....I hope you can now check for
rest.....
|
|
|
08-13-2002, 05:08 AM
|
#3
|
Member
Registered: May 2002
Location: Wales
Distribution: Slack 8.1, Gentoo 1.3a, Red Hat 7.3, Red Hat 7.2, Manrake 8.2
Posts: 328
Original Poster
Rep:
|
many thanks
while on the subject of binary conversion for this command I take it that 7 is the highest decimal number you can use hence only using a 3 bit binary pattern.
Would this therefore also be valid to allow full read write xecute access to all : -
chmod 111111111 or even
chmod 1FF (Dont think this would because its based on the total value of the full string above not three seperate 111)
Last edited by dai; 08-13-2002 at 05:20 AM.
|
|
|
08-13-2002, 05:15 AM
|
#4
|
Member
Registered: Jun 2002
Location: Kanpur,India
Distribution: RH-7.0 , 7.3
Posts: 130
Rep:
|
check it for urself  & tell us too
(actually i cant do right now cos in windows)
|
|
|
08-13-2002, 05:17 AM
|
#5
|
Member
Registered: May 2002
Location: Wales
Distribution: Slack 8.1, Gentoo 1.3a, Red Hat 7.3, Red Hat 7.2, Manrake 8.2
Posts: 328
Original Poster
Rep:
|
hmmm I shall do that
it should theoretically be possible I mean Linux is capable of differrentiating between number bases isnt it???
(I cant check now coz Im in work and using Windows if anybody is in Linux and his willing to try it, let us know the outcome please  )
Last edited by dai; 08-13-2002 at 05:24 AM.
|
|
|
08-13-2002, 05:25 AM
|
#6
|
Member
Registered: Oct 2001
Location: Dublin, Ireland
Distribution: Mandrake 9.0 mostly!
Posts: 303
Rep:
|
Nope dosent work:
[root@localhost amp2000]# chmod 111111111 plugin131.trace
chmod: invalid mode string: `111111111'
[root@localhost amp2000]#
|
|
|
08-13-2002, 05:39 AM
|
#7
|
Member
Registered: May 2002
Location: Wales
Distribution: Slack 8.1, Gentoo 1.3a, Red Hat 7.3, Red Hat 7.2, Manrake 8.2
Posts: 328
Original Poster
Rep:
|
many thanks amp
it may work if you specify that your working in base 2 before hand and also seperate each block of 111. I dont know if you can do that or not does anybody else, Im curious to know???
Last edited by dai; 08-13-2002 at 05:43 AM.
|
|
|
08-13-2002, 07:46 AM
|
#8
|
LQ Addict
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704
Rep:
|
Don't think about permission being a decimal number - it is octal, and the system understands octal through binaty representation, so a base 8 digit can be represented with three bits binary (2 in the power of three is 8), so this is why you have 7 as 111 (or r=1 w=1 and x=1), and 4 in base 8 you can express as 100 (r=1, no write and executable permissions - READ ONLY), and so forth. So chmod only accepts octal number or letter notation (u+x o-w and so on)
|
|
|
08-13-2002, 08:06 AM
|
#9
|
Member
Registered: May 2002
Location: Wales
Distribution: Slack 8.1, Gentoo 1.3a, Red Hat 7.3, Red Hat 7.2, Manrake 8.2
Posts: 328
Original Poster
Rep:
|
Okay
4 in decimal = 100 in binary
100 in octal is in fact = 63
so in fact the decimal value for 100 (octal) is 63
so your saying the binary encoding used is increasing by 8 for each bit i.e.
64 8 1 <------------- decimal values for 3 bit octal
1 1 1 (r w x)
1 0 0 (r - -)
1 0 1 (r - x)
1 1 0 (r w -)
etc................................................
Last edited by dai; 08-13-2002 at 08:09 AM.
|
|
|
08-13-2002, 08:37 AM
|
#10
|
LQ Addict
Registered: Dec 2001
Location: Brooklyn, NY
Distribution: *NIX
Posts: 3,704
Rep:
|
nope , each digit in the permission pattern is octal (0 through 7) try enter 8 and see chmod complaining about it, now each one of these are represented through 3 bit binary (2 in the power of 3 gives you 8, so it means with three bit binary you can construct an octal digit from 0 to 7 in total of eight) so to say
octal 3-bit binary
0 000
1 001
2 010
3 011
--------------
7 111
So, now each digit in the permission pattern is octal representation of read, write, execution bits for a defined field - owner, group, others.
so if you put it all together
chmod 777 is translated to a binary pattern with each digit represented in 3-bit binary (3-bit - 1 bit for r, 1 bit for w and one bit for x)
chmod 111 111 111
or
chmod rwx rwx rwx
| | |___others
| |______group
|__________owner
is it clear?
Last edited by neo77777; 08-13-2002 at 08:41 AM.
|
|
|
08-13-2002, 09:05 AM
|
#11
|
Member
Registered: May 2002
Location: Wales
Distribution: Slack 8.1, Gentoo 1.3a, Red Hat 7.3, Red Hat 7.2, Manrake 8.2
Posts: 328
Original Poster
Rep:
|
ahhhhhh I keep messing up my conversion tables doh!!!!!!!!!!!
I only realised what I was doing when I looked at the hex number F which is equal to 15 in decimal or 1111 binary.
you dont increment 1 8 64 in octal (stupid thing to do)
you increment 1 2 4 8 16 32 64 128 etc.....for all number bases
the only time you do increment 1 8 16 32 etc....is if you convert from binary into octal via decimal i.e.
1111 (binary)
becomes 15 (decimal)
which then becomes 017 (octal)
Last edited by dai; 08-13-2002 at 09:07 AM.
|
|
|
All times are GMT -5. The time now is 02:39 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|