Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Can you help me understand chown and chmod? Not urgent.

  1. #1
    Join Date
    Apr 2008
    Beans
    11,533

    Can you help me understand chown and chmod? Not urgent.

    For quite some time I've been multi-booting (sometimes as many as 10 or 12 OS's) and I discovered long ago that symlinking to separate data partitions is a great way of always having access to the newest Documents, Downloads, etc.

    Like if I'm playing around in Squeeze or Maverick and something suddenly goes south I can boot into my stable OS and everything I've been working on is right there. That's also helpful when I start first thing in the AM as I don't have to remember which OS I was using last

    Anyway I know how to do everything needed to complete that process now using only the command line, basically either "rm" or "mv" the old directories if they exist, then:

    gksudo gedit /etc/fstab

    and add:

    #/dev/sda5 /mnt/sda5 /home/lance/Backups
    UUID=594c3d40-2791-4c0a-8644-d9812545da2d /mnt/sda5 ext3 defaults 0 2
    #/dev/sda6 /mnt/sda6 /home/lance/Pictures
    UUID=8a3f6c83-cb52-4caf-96b8-5faf2c830453 /mnt/sda6 ext3 defaults 0 2
    #/dev/sda7 /mnt/sda7 /home/lance/Downloads
    UUID=05289ee4-d681-4806-b6fd-aefd784f9323 /mnt/sda7 ext3 defaults 0 2
    #/dev/sda8 /mnt/sda8 /home/lance/Documents
    UUID=571cfad8-68c7-4703-883e-c0baa2a381d4 /mnt/sda8 ext3 defaults 0 2

    Then create the directories:

    sudo mkdir /mnt/sda5 && sudo mkdir /mnt/sda6 && sudo mkdir /mnt/sda7 && sudo mkdir /mnt/sda8

    And create the symlinks:

    ln -s /mnt/sda5 /home/lance/Backups && ln -s /mnt/sda6 /home/lance/Pictures && ln -s /mnt/sda7 /home/lance/Downloads && ln -s /mnt/sda8 /home/lance/Documents

    Now, here's the catch! So far I've always failed with the chown and chmod process

    After completing all of the above successfully I've just been using the GUI to correct ownership and privileges as such:

    Screenshot-Backups Properties.png

    While that works perfectly and can hardly be considered difficult I have the desire to learn how to complete that final step using the CLI

    Any advice will be appreciated.

  2. #2
    Join Date
    Jun 2008
    Location
    California
    Beans
    154
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Can you help me understand chown and chmod? Not urgent.

    Why don't you open up a terminal (Applications->Accessories->Terminal) and execute these commands:
    man chmod
    man chown
    That should get you started and when you run into trouble, you can always come back and post here.

  3. #3
    Join Date
    May 2007
    Location
    The New Forest
    Beans
    Hidden!
    Distro
    Xubuntu

    Re: Can you help me understand chown and chmod? Not urgent.

    I found this page on chmod particularly helpful as you can see an easy representration of what you are doing

    http://ss64.com/bash/chmod.html

    This also - https://help.ubuntu.com/community/FilePermissions

    I guess without knowing why and how it fails for you it's hard to offer anything more concrete than that.

  4. #4
    Join Date
    Apr 2008
    Beans
    11,533

    Re: Can you help me understand chown and chmod? Not urgent.

    Quote Originally Posted by jobix View Post
    Why don't you open up a terminal (Applications->Accessories->Terminal) and execute these commands:

    That should get you started and when you run into trouble, you can always come back and post here.
    Been there and done that. I'd obviously researched this considerably to get as far as I have.

    Somehow I simply always get something wrong when I try to correct ownership and permissions using the command line.

  5. #5
    Join Date
    Dec 2009
    Beans
    5,804

    Re: Can you help me understand chown and chmod? Not urgent.

    I'm a little slow today so let me see if I've got this right:

    You're mounting /dev/sda5 to /mnt/sda5
    Then you're creating a link from /mnt/sda5 to /home/lance/Backups
    Then you're correcting ownership to all enclosed folders and files in /home/lance/Backups so that lance can read and write to them.

    Don't you have to do that every time you boot into one of the other 12 OS's. Unless you have a "lance" on every other OS and that lance has the same user number ( i.e., in Ubuntu it's 1000 , in Mandriva it's 500 ), that's kind of awkward.

  6. #6
    Join Date
    Apr 2008
    Beans
    11,533

    Re: Can you help me understand chown and chmod? Not urgent.

    Quote Originally Posted by forestpiskie View Post
    I found this page on chmod particularly helpful as you can see an easy representration of what you are doing

    http://ss64.com/bash/chmod.html

    This also - https://help.ubuntu.com/community/FilePermissions

    I guess without knowing why and how it fails for you it's hard to offer anything more concrete than that.
    That second link may be just the ticket

    How did I manage to overlook that

    Sometimes a second pair of eyes is needed, I'll parse that a bit and see if I can boil it down.

    Many thanks.

    If I encounter a failure I'll try to post all pertinent info.

  7. #7
    Join Date
    Apr 2008
    Beans
    11,533

    Re: Can you help me understand chown and chmod? Not urgent.

    Quote Originally Posted by Morbius1 View Post
    I'm a little slow today so let me see if I've got this right:

    You're mounting /dev/sda5 to /mnt/sda5
    Then you're creating a link from /mnt/sda5 to /home/lance/Backups
    Then you're correcting ownership to all enclosed folders and files in /home/lance/Backups so that lance can read and write to them.

    Don't you have to do that every time you boot into one of the other 12 OS's. Unless you have a "lance" on every other OS and that lance has the same user number ( i.e., in Ubuntu it's 1000 , in Mandriva it's 500 ), that's kind of awkward.
    Well, so far I've mostly stuck with Debian based distros, but I did once throw Fedora into the mix and encountered no real problems other than having to use the GUI method of correcting permissions/ownership.

    No problem so far with permissions changing in one distro after linking to another distro, but anything could happen

    As I said this is not urgent, just something I'd like to understand better.

  8. #8
    Join Date
    Dec 2009
    Beans
    5,804

    Re: Can you help me understand chown and chmod? Not urgent.

    But you're in an infinite loop. You correct ownership in Ubuntu, change ownership in Fedora, and then have to change ownership In Ubuntu again. Am I missing something?

  9. #9
    Join Date
    May 2010
    Beans
    2

    Re: Can you help me understand chown and chmod? Not urgent.

    your best be would be to make sure your user id is always the same number as suggested earlier. I'm guessing you just want to do a recursive chown and perhaps a chmod? I would imagine chown alone would fix your permission issues so you might not need chmod

    sudo chown -R lance /mnt/sda5 /mnt/sda6 /mnt/sda7 /mnt/sda8

    also you might want to include your user group in the command wheras you pass user:group

    for example

    sudo chown -R lance:users /mnt/sda5 /mnt/sda6 /mnt/sda7 /mnt/sda8

    that would recursively change ownership on everything to user lance and group users

    if you really want to get creative you could put all of this stuff in /etc/rc.local (assuming that is used in ubuntu) and have it run automatically when the system boots

  10. #10
    Join Date
    Dec 2009
    Beans
    5,804

    Re: Can you help me understand chown and chmod? Not urgent.

    Since you have 12 OS's and apparently like to tinker I would suggest the following alternative that you might want to try out.

    I have a common linux data partition /DATA and use the following two lines in the fstab of every linux OS installed on my system:
    Code:
     LABEL=Data /DATA           ext3    defaults,noatime        0       2
     bindfs#/DATA /home/Shared fuse perms=0666:+X 0 0
    /home/Shared will "bind" to /DATA with all it's content except:

    All existing and new files added in /home/Shared will have permissions set to 666 - universal read / write.
    All existing and new directories in /home/Shared will have permissions set to 777 so they can be opened.

    Conceptually it's exactly the same thing you're trying to achieve with the fstab mount, symbolic link, and chmod.

    BINDFS HowTo: http://ubuntuforums.org/showthread.php?t=1460472

    Just an idea.
    Last edited by Morbius1; May 28th, 2010 at 08:27 PM.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

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