Results 1 to 4 of 4

Thread: How to use chmod to access all subdirectories

  1. #1
    Join Date
    Nov 2008
    Posts
    1,022

    How to use chmod to access all subdirectories

    I am working on a Linux server. I am logged on with the root admin. I would like to assign only few users to get access to all files and folders of a directory. Is it possible? Do you know how does chmod works to access all subdirectories? I want the fastest way to achieve my target.

  2. #2
    Join Date
    May 2008
    Posts
    962

    Re: How to use chmod to access all subdirectories

    Basically Chmod changes the file/folder permissions in Linux. If you use the -R option along with this command you can change files/folders recursively. So, to enable the write permissions to a directory named "myDir" use

    Code:
    chmod -R +w myDir
    However this may give you an error or warning message asking you for confirmation. If you don't want this error or warning message then simply use "-f" option.

  3. #3
    Join Date
    Nov 2005
    Posts
    3,026

    Re: How to use chmod to access all subdirectories

    The above code only works for single file/folder but not for all subdirectories. In the above case you have to use the above code several times to get access for all file/folder. In order to get access to all subdirectories use 777 as below:

    Code:
    chmod -R 777 myDir
    where myDir is the directory whose subdirectories you want to access.

  4. #4
    Join Date
    Nov 2005
    Posts
    1,203

    Re: How to use chmod to access all subdirectories

    chmod -R will change everything and not just directories. In order to get access of only directories you can use find + xargs something like this:

    Code:
    find DIRECTORY_NAME -type f | xargs chmod permissions
    Just remember that xargs considers ASCII characters also, and so filenames containing spaces and upper or lower characters means different and the result is also different for everything.

Similar Threads

  1. How to remove windows empty subdirectories
    By Dr.Jones in forum Tips & Tweaks
    Replies: 1
    Last Post: 02-07-2012, 01:30 PM
  2. What does chmod 654 stand for?
    By Akono in forum Operating Systems
    Replies: 4
    Last Post: 31-12-2011, 02:08 AM
  3. How to access CHMOD on Mac OSX
    By DENNI$SON in forum Operating Systems
    Replies: 7
    Last Post: 06-09-2011, 10:21 AM
  4. Counting all files in a directory (and subdirectories)
    By Sarasija in forum Operating Systems
    Replies: 4
    Last Post: 22-08-2010, 01:03 AM
  5. save a directory by chmod 777
    By purvagarg in forum Software Development
    Replies: 3
    Last Post: 13-03-2009, 06:37 PM

Tags for this Thread

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
  •  
Page generated in 1,714,004,172.42903 seconds with 17 queries