Chmod..

I got tired of getting permissions errors on Apache/Zend/PHP so I did:

chmod -R 777 my_website_root

I know… a bit silly… Now Apache will serve up practically everything, even breakfast :slight_smile:

How do I go back, 777 is the only modifier I know…

/jlar

And it’s a mode that should very seldom be used. Much more useful to learn these two commonly used modes: 644 and 755.

All numbers to you? Try these equivalent descriptors u=rw,g=r,o=r and u=rwx,g=rx,o=rx.

Still just a bunch of letters to you? Then try this tutorial: File system permissions - Wikipedia, the free encyclopedia

Oh and how to get back your original modes. Well if you didn’t have a backup, then you have to guess what the original modes were. Something to think about next time you are tempted to do a chmod -R.

eeijlar wrote:

>
> I got tired of getting permissions errors on Apache/Zend/PHP so I did:
>
>
> Code:
> --------------------
> chmod -R 777 my_website_root
> --------------------
>
>
> I know… a bit silly… Now Apache will serve up practically
> everything, even breakfast :slight_smile:
>
> How do I go back, 777 is the only modifier I know…
>
> /jlar
>
>
Thread moved from General to Applications forum
(opensuse.org.help.applications)

For the number side of Chmod, it’s based on there numbers…

  • 4 = Read
  • 2 = Write
  • 1 = Execute

If you notice, you can’t add any of these numbers up to equal another set. IE: If I want to add the permissions to execute and write for root, I would add 1 + 2 = 3, so I would issue the command: chmod 300 file.txt. You can also use the alphabetical method for permissions: you can add just one permission at a time, rather than editing the entire set as in the case of the number method. For this, you need to declare which type of user will gain or lose a specified permission. In short, you have to the issue a command like the following:

chmod u+w file.txt

The above command will allow the group: User to write this file. The different groups include…

  • u = User
  • g = Group
  • o = Others
  • a = All User

Then you can also change the plus sign (+) to a minus sign (-) to remove a permission. The following…

chmod u-w file.txt

That would remove “User” permission to write the file.

In your case, I would go with the numbers method, so you can edit all the permissions all at once rather than changing them one-by-one.

Hope that helps. :slight_smile:

Thanks everyone… :slight_smile: