Announcement

Collapse
No announcement yet.

Change permissions for a folder

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Change permissions for a folder

    I was mucking about on a folder last night and wanted to change the file permissions such that I can edit the files. I executed the following command:
    Code:
    sudo chmod -R 664 iPhonePhotos/
    Now, the folder is no longer accessible as a regular user. I need to be root in order to even open the folder. The current permissions for this folder are:
    Code:
    drw-rw-r-- 17 vamsi vamsi  4.0K Feb 10 17:25 iPhonePhotos
    No matter what I do, the folder remains inaccessible to the user 'vamsi'. I have already used chown and chgrp commands to change the ownership and group. And AFAICT, the user, group and other all have at least read permissions. Anyone know what I may be missing here?

    #2
    For directories, the directory access needs the execute (or seek) permission
    Code:
    sudo chmod 775 iPhonePhotos
    As you used 664 recursively, any subdirectories under iPhonePhotos will also have the wrong permissions

    Comment


      #3
      Hi
      since you have already done all of that, and I CANNOT help like others can and I am sure that someone will be along in a short while.

      But, I've tried to do this several times with no success.

      However, I am sure that you have heard about the whole KDE thing about not allowing root permissions.

      https://www.dedoimedo.com/computers/...n-as-root.html

      I ran across this whole controversy a few weeks ago and found that there is another version of Dolphin known as "Dolphin4" it is in the repos and will run as root with a sudo.

      Don't know if this will help with your particular problem but, again, I'm sure that someone will be along shortly that is much smarter than the old woodsmoker

      woodlikesDolphin4smoke

      Comment


        #4
        IMO sudo chmod - R can be dangerous, I have borked a system using it.

        As kubicle pointed out, to access files in a directory you need x permission on it, and so 7 not 6, even if you own the directory.

        But chown -R 775 will make all the files executable, even, say, photos. Other than from a security perspective, I can't imagine much trouble from this, but it might look messy.

        I approach tasks like this by identifying the files first, checking them, then applying changes with simpler commands. So maybe
        Code:
        # get the directories 
        find photo_dir -type d > x
        # check that the contents of x look right
        more x
        # if they're ok
        sudo chmod 775 $(<x)
        # get the plain files
        find photo_dir -type f > x
        # check x
        more x
        # if ok
        sudo chmod 664 $(<x) 
        rm x
        Change "photo_dir" to suit.

        Using sudo chmod doesn't sound right, though. More often changing the ownership is what's needed, or fixing the way some device is mounted.

        (Sorry about the long tutorial, I think I'll quickly point out something and end up fleshing out a careful answer.)

        Regards, John Little
        Regards, John Little

        Comment


          #5
          You can also use
          Code:
          sudo chmod -R +X iPhonePhotos
          (Note the capital "X"), this will recursively add the execute bit to directories (and files that already has the execute bit set for one user), and leave regular files alone

          Comment

          Working...
          X