-
Mar 7th, 2012, 04:25 PM
#1
[RESOLVED] Homework - Permission
Hi,
I'm not sure if this goes in here or not but I am having trouble understanding how permission are changed.
Example:
This is an example our lecturer went through with us in class.
Determine the permissions that would apply if the following chmod commands were run?
chmod 777 file1 –rwxrwxrwx file1
chmod 754 file2 –rwxr-xr- file2
chmod 4222 file3 –wS-w—w- file3
chmod 2345 file4 –rwxr-Sr-x file4
chmod 1555 file5 –r-xr-xr-t file5
chmod 5705 file6 –rws---w-xt file6
Now, I understand that 777 is for a file and 666 is for a folder when everything is in player I am just confused how we ended up with the other values?
Thanks,
Nightwalker
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 7th, 2012, 07:13 PM
#2
Re: Homework - Permission
-
Mar 7th, 2012, 08:00 PM
#3
Re: Homework - Permission
Thanks! Although, I notice that S and t, etc weren't on that page?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Mar 7th, 2012, 08:13 PM
#4
Re: Homework - Permission
Code:
s setuid/gid details in Special modes section
t sticky details in Special modes section
from wikipedia source:
http://en.wikipedia.org/wiki/Chmod
-
edited to add:
http://superuser.com/questions/14771...le-permissions
Last edited by proneal; Mar 7th, 2012 at 08:16 PM.
Reason: added a second url for more help
-
Mar 8th, 2012, 12:21 AM
#5
Re: Homework - Permission
Originally Posted by Nightwalker83
Hi,
I'm not sure if this goes in here or not but I am having trouble understanding how permission are changed.
Example:
This is an example our lecturer went through with us in class.
Determine the permissions that would apply if the following chmod commands were run?
chmod 777 file1 –rwxrwxrwx file1
chmod 754 file2 –rwxr-xr- file2
chmod 4222 file3 –wS-w—w- file3
chmod 2345 file4 –rwxr-Sr-x file4
chmod 1555 file5 –r-xr-xr-t file5
chmod 5705 file6 –rws---w-xt file6
Now, I understand that 777 is for a file and 666 is for a folder when everything is in player I am just confused how we ended up with the other values?
Thanks,
Nightwalker
chmod assigns permissions based on octal values. For three-digit assignments, the first digit will be for "user", second digit for "group", third digit for "other". These are commonly called UGO permissions. Wikipedia has more information.
Note: You should never assign permissions of 777 (u=rwx,g=rwx,o=rwx) to any file or directory unless you want it to be world-writable for all users. Some system directories are normally set to 777. eg. /tmp
Files normally have 644 (u=rw,g=r,o=r) so they are not executable. Directories require execute permissions to be able to list the contents. This is normally 755 (u=rwx,g=rx,o=rx).
-
Mar 8th, 2012, 12:26 AM
#6
Re: Homework - Permission
It's easy to get confused coming from a Windows environment to *nix for the first time. Windows uses ACLs instead of the traditional unix permissions (I think Linux/Unix also supports posix ACLs). You can see this in action when you copy a file (eg. .doc) from a Windows machine to a USB stick. Viewing the contents of the USB stick under Linux would show the file to have permissions of 755, since all files in Windows are executable.
-
Mar 8th, 2012, 12:30 AM
#7
Re: Homework - Permission
Not sure if you've got to this yet, but umask can be used to set the file mode creation mask to specify the default permissions on new files. It's normally set from a login script such as ~/.profile.
Last edited by tr333; Mar 8th, 2012 at 12:35 AM.
-
Mar 8th, 2012, 12:39 AM
#8
Re: Homework - Permission
Originally Posted by tr333
Not sure if you've got to this yet, but umask can be used to set the file mode creation mask to specify the default permissions on new files. It's normally set from a login script such as ~/.profile.
Yeah, our lecturer talked to us about unmasking at Monday's class. Hopefully, we will have a repeat of that lesson because I was one of two students in class previously.
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Apr 16th, 2012, 12:05 AM
#9
Re: Homework - Permission
Here is an example of how chmod works, at least it is simple enough for me to understand.
-rws (s represents suid) r-S (S represents sGid) r-- (the last - is where the sticky bit would be) file x
The chmod for that would be $chmod 6744 file x
rws = 7
r-- = 4
s from the suid = 4
S from the sGid = 2
The sticky bit would equal 1 if it were enabled, represented by a "t".
So the the original number 744 would not change but number in front will depending on whether a small or big "S" or a sticky bit.
Edit:
Forgot to say that big S or T = 0 or off and small s or t = 1 or on.
Last edited by Nightwalker83; Apr 29th, 2012 at 11:09 PM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Apr 17th, 2012, 09:08 PM
#10
Re: Homework - Permission
Great stuff. I never bothered to learn about the extra sticky/setuid/setgid bits, but maybe I should.
-
Apr 17th, 2012, 10:47 PM
#11
Re: Homework - Permission
Yeah, it is interesting although, I have trouble understanding what seems normal teaching methods to some people that is why the above explanation (post #9) may seem a bit dumb down. I personally hate it don't dumb things down and make it easier for everyone to understand.
Edit:
Found this Permissions Calculator which, might be useful if you are a dummy like me at this stuff.
Last edited by Nightwalker83; Jun 11th, 2012 at 08:27 PM.
Reason: Adding more!
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|