Linux - GeneralThis 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.
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.
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.
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.....
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)
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???
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)
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.