Find the answer to your Linux question:
Results 1 to 6 of 6
I have Ubuntu 7.04 and have recently also installed Xubuntu 7.10 - I use the same username ("erfahren") for both and am the only user. for Ubuntu I have a ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2008
    Location
    Colorado, USA
    Posts
    3

    help with clarifying directory permissions for ext3 mounted partitions


    I have Ubuntu 7.04 and have recently also installed Xubuntu 7.10 - I use the same username ("erfahren") for both and am the only user.

    for Ubuntu I have a root partition and a /home partition -- and for Xubuntu I have a root partition and a /home partition
    - all the filesystems are ext3

    I went by this tutorial to mount my Ubuntu /home partition in Xubuntu. I set the mount point as /mnt/ubuntu_home

    at the bottom of that guide it says to set the permissions like:
    Code:
    sudo chown -R erfahren:erfahren /mnt/ubuntu_home
    sudo chmod -R 755 /mnt/ubuntu_home
    I just recently noticed when using my Ubuntu 7.04 that all my files in my /home/erfahren directory were now set to be executable. I realized later that it was because of those permissions I set (the recursive part). - I have that part worked out (mostly) but if I reinstall or install another distro I'd like to have clarification on how to properly set the permissions.

    I have read that the permission to execute needs to be set on the directory itself in order to "access it", does that mean being able to read and write to it and its contents? - The reason I ask that is because a couple of guides gave an example of being able to list its contents and didn't mention reading and writing to it.

    So would the proper way to set them be just "sudo chomd 755 /mnt/ubuntu_home" ? Would that allow me to read, write, delete, etc. the subdirectories and contents?

    I've searched and came up with many guides related to mounting Windows partitions (and the like) and many on file permissions but none seemed to go into too much depth about mounting other Linux partitions and setting permissions.

    oh, an example of the line in my (Xubuntu's) /etc/fstab - (could it be made differently to do what I want?)
    Code:
    # ubuntu home
    /dev/sda6       /mnt/ubuntu_home     ext3    defaults        0       0
    thanks for any help

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,729
    So would the proper way to set them be just "sudo chown 755 /mnt/ubuntu_home" ? Would that allow me to read, write, delete, etc. the subdirectories and contents?
    Yes. Thats the proper way. Dont change permissions ( chmod ). Just give ownership of mount point ( /dev/ubuntu_home ) to a user. In other words, execute chown command only.
    Code:
    sudo chown erfahren:erfahren /mnt/ubuntu_home
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    Everything in the Linux filesystem has the same three permissions: read, write, execute. These are a bit strange for directories, but they make sense:

    read: allows you to view the contents of a directory (with a utility such as ls)
    write: allows you to create and remove entries in the directory. Note that if you have write permissions on a directory, you can remove files created by other users in that directory.
    execute: allows you to enter a directory

    So for instance, my home directory at school has permissions rwx--x--x. This means that only I can view its contents or create things inside that directory. Other people can enter the directory, but cannot see anything there. The reason for my doing this is that my ~/.www directory needs to be accessible to have a website, but I don't want people to be able to see anything else of mine.

    Make sense?

  4. $spacer_open
    $spacer_close
  5. #4
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Quote Originally Posted by Cabhan View Post
    write: allows you to create and remove entries in the directory. Note that if you have write permissions on a directory, you can remove files created by other users in that directory.
    Sticky bit notwithstanding?

  6. #5
    Just Joined!
    Join Date
    Jan 2008
    Location
    Colorado, USA
    Posts
    3
    thanks devils_casper - (and thanks for catching my typo - I meant to put "chmod" there).

    It usually takes me going back and fixing stuff for me to learn - a bad habit, but a fairly effective one.

    I read more on the /etc/fstab at tuxfiles and have a much better understanding on that as well. Using the defaults mount options already includes read/write

    between that and setting the ownership gives me what I need. (I realized that since I use the same username on both distros that may not even be necessary.)

    I understand the purpose of only setting the execute permission on a directory now too, Cabhan - (I couldn't figure out the point of letting a user enter a directory and not being able to see the contents). After going back and re-reading the tuxfile page on permissions I saw that it says a user would not be able to list the contents. The execute permission would need to be set on a main directory in order for a user to have access to one of its subdirectories.

    I think I have a good handle on this now.

    thanks again folks!

  7. #6
    Linux Guru Cabhan's Avatar
    Join Date
    Jan 2005
    Location
    Seattle, WA, USA
    Posts
    3,252
    Quote Originally Posted by scm View Post
    Sticky bit notwithstanding?
    Of course. I just ignored that and the s/guid bits for simplicity's sake.

    And ehrfahren, another reason for such a thing is that you might have files named by default (~/.bashrc, for instance), that people can still access, supposing that they already know the name. It's admittedly not a common situation, but it does exist.

    Also, note that username is meaningless. This stuff is all actually handled via UIDs (user IDs), which may be different across different systems. So it may will still be necessary to explicitly set ownership.

Posting Permissions

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