Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialChris Andruszko
18,392 PointsCan't use chmod 777 :(
I'm working on a website that has a chat feature. Everything that's written in the chat box has to be written into another document in order for it to show up in the chat window. That document needs to have 777 permission in order to work.
The chat feature works perfectly fine locally using MAMP. But when I put it online (I use iPage as my host), the chat doesn't work. It seems iPage restricts 777 files by ignoring them completely. Understandably for security reasons.
Does anyone have any solutions to make this work?
Chris Andruszko
18,392 PointsThis is the problem I have with a lot of tutorials. Although chmod 777 doesn't seem safe, many tutorials I found suggested doing that. Oh well. Thanks for the information you provided. I'll be doing a fair bit of research this weekend.
Lawrence Francell
Courses Plus Student 17,992 PointsLawrence Francell
Courses Plus Student 17,992 Points777 means read and write and execute for Owner, Group and Everyone. So if everyone can write to the file and execute it, then they could inject a script and run the script which could be catastrophic to the host server and at the very least, your files.
Your best bet is to look into what are called POSIX Permissions and learn a bit about your needs.
Here is a rough example of what 777 means: 7 7 7 d rwx rwx rwx type user group other
how the calculation works: 4+2+1 = 7 r w x
The "rwx" stand for read, write, execute The "d" or sometimes "l" (lower case ell) at the front of the permissions means directory or sim-link respectively. You NEVER EVER want to give "other" rwx permissions on a scripting platform - i.e. php. Server hosts ignore them completely to save their servers from attack.
You may need to set the file owner to whatever the web-server user is, and then give it read/write permissions, and group and other read only permissions i.e. 644 6 4 4
You may not have access to the server username so you might need to set group permissions to read/write i.e. 664 : but use that with caution as well, make sure you know what group is assigned to the file. It is likely the same as the user running the server such as your user account.
If you are having more trouble, contact your host admin or user support and discuss with them what you need. A good host should be your best help for getting the file the access it needs.
Reference: About halfway down the page is a nice chart of Permissions settings calculations. http://www.cs.colostate.edu/~cs556/projects/project-2/Exercise.html
also, wikipedia for what it's worth. https://en.wikipedia.org/wiki/File_system_permissions