[RESOLVED] Homework - Permission-VBForums
Results 1 to 11 of 11

Thread: [RESOLVED] Homework - Permission

  1. #1

    Thread Starter
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    12,799

    Resolved [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-ww- 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.
    Please consider giving me some rep points if I help you a lot.
    Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  2. #2
    Fanatic Member proneal's Avatar
    Join Date
    May 2011
    Posts
    762

  3. #3

    Thread Starter
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    12,799

    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.
    Please consider giving me some rep points if I help you a lot.
    Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  4. #4
    Fanatic Member proneal's Avatar
    Join Date
    May 2011
    Posts
    762

    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 07:16 PM. Reason: added a second url for more help

  5. #5
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,505

    Re: Homework - Permission

    Quote Originally Posted by Nightwalker83 View Post
    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-ww- 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).
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  6. #6
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,505

    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.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  7. #7
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,505

    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 7th, 2012 at 11:35 PM.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  8. #8

    Thread Starter
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    12,799

    Re: Homework - Permission

    Quote Originally Posted by tr333 View Post
    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.
    Please consider giving me some rep points if I help you a lot.
    Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  9. #9

    Thread Starter
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    12,799

    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.
    Please consider giving me some rep points if I help you a lot.
    Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

  10. #10
    Frenzied Member tr333's Avatar
    Join Date
    Nov 2004
    Location
    /dev/st0
    Posts
    1,505

    Re: Homework - Permission

    Great stuff. I never bothered to learn about the extra sticky/setuid/setgid bits, but maybe I should.
    CSS layout comes in to the 21st century with flexbox!
    Just another Perl hacker,

  11. #11

    Thread Starter
    Web developer Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    12,799

    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.
    Please consider giving me some rep points if I help you a lot.
    Links to my code examples can now be found on my website: My websites
    Please rate my post if you find it helpful!
    Technology is a dangerous thing in the hands of an idiot! I am that idiot.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.