#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Mumbai, India
    Posts
    276
    Rep Power
    15

    Write permissions to everyone


    Hi
    I want to allow write permissions to everyone on my website though its risky.
    I use the command
    chmod a+w *.*
    It allows permission to the root files and not to files in the directories. Again, when I add a file, I have to use the same command again.
    How do I apply write permission to all the directories and subdirectories?


    Shantanu oak
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    Heemskerk, The Netherlands
    Posts
    254
    Rep Power
    14
    chmod -R a+w *

    chmod -R 666 * (the one I would use, it gives everyone rw rights, use 777 when you want to give everyone rwx rights)

    Marc
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Mumbai, India
    Posts
    276
    Rep Power
    15

    Please explain -R and *


    Hi,
    Thanks a lot for telling me how to allow read, write permissions.
    I typed the commands mentioned above.
    Let me tell you, I am not an expert. So can you please explain me what this command stand for?
    I typed
    chmod -R 666 *
    and I could not access my server.
    then I typed
    chmod -R 777 *
    and I could access my server and I got the write permissions, (what I was looking for)

    The Point is I need a bit guidance...

    1. What does R stand for?
    2. Does it mean that if I use only * instead of *.* it will be applied to all the directories?
    3. In the first command mentioned above (666), it means read and write. Does it mean that unless the people have execute permissions they can't "read" the page?
    4. What is the difference between read and execute rights?
    5. After I have typed the command (for eg. -R 777 *) how can I go back to the default setting of my server?

    (I do understand what these number stand for I referred to the site http://shantanuoak.com/unix/advance.htm for the same)

    Thanks
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Location
    Heemskerk, The Netherlands
    Posts
    254
    Rep Power
    14
    ok -R stands for recursive, that means it gives any file or subdirectory those rights you give in the chmod command.

    When you give rw rights to directory and all the files in it you cannot read the files unless you know the exact filename because you don't have the execute rights on that directory.

    But do you need to give eveyone write rights on the files for your site, when you just give them read and execute (5) it will do.

    the numbers in chmod , correct me if I'm wrong

    1 execute
    2 write
    3 write + execute (1 + 2)
    4 read
    5 read + execute (4 + 1)
    6 read + write (4 + 2)
    7 read + write + execute (1 + 2 + 4)

    the first number is the user, the second the primary usegroup, the third everyone else.

    The difference between read and execute is exactly what the words mean, when you can read a file you can look at the contents of the file, when you can execute the file it means you can execute the file / script like it as a program (shell scripts for example)

    * stands for everything, *.* stands for every file with a dot in it, maybe the dot will be interpreted by the shell as a replacement for any character (that's what a dot means in regular expressions)

    maybe it's best for you if you give 755 to the directories and 766 to the files.

    Marc
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2000
    Location
    Mumbai, India
    Posts
    276
    Rep Power
    15

    Thank You


    Dear Sir,
    Thanks for teaching me the right (Programmer like) apporach.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2001
    Posts
    4
    Rep Power
    0
    >> I typed chmod -R 666 * and I could not access my server.

    When you do a recursive chmod to a directory, all the subdirs and files within it will become 666 in permission. For a directory to serve webpage when Apache is running as nobody, 755 should do just fine. But you wanted to allow everyone's CGI scripts write access, then you need to chmod those dirs 777. That said, chmod'ing a dir to 666 won't work anymore.

    What you really should do is to chmod dirs to 777 and files to 666. To do this, run the following command:

    find /path/to/that/dir -type d -exec chmod 777 {} \;

    Then run the following command to chmod files (just files, not dirs) to 666:

    find /path/to/that/dir -type f -exec chmod 666 {} \;

IMN logo majestic logo threadwatch logo seochat tools logo