News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Checking Files are Writable - file permissions are set but error persists

Started by jeffm01, November 16, 2018, 09:59:16 PM

Previous topic - Next topic

jeffm01

[b]My files:[/b]

[jeff@localhost html]$ pwd
/var/www/html
[jeff@localhost html]$ ls -l
total 624
-rwxrwxrwx. 1 root root   3343 Nov 17 13:57 agreement.txt
drwxrwxrwx. 2 root root   4096 Nov 17 13:57 attachments
drwxrwxrwx. 4 root root   4096 Nov 17 13:57 avatars
drwxrwxrwx. 2 root root   4096 Nov 17 13:57 cache
-rwxrwxrwx. 1 root root     67 Nov 17 14:56 index.html
-rwxrwxrwx. 1 root root  14612 Nov 17 13:57 index.php
-rwxrwxrwx. 1 root root  62550 Nov 17 13:57 install_2-0_mysql.sql
-rwxrwxrwx. 1 root root 129466 Nov 17 13:57 install_2-0_postgresql.sql
-rwxrwxrwx. 1 root root 119933 Nov 17 13:57 install_2-0_sqlite.sql
-rwxrwxrwx. 1 root root  88295 Nov 17 13:57 install.php
-rwxrwxrwx. 1 root root   1464 Nov 17 13:57 license.txt
-rwxrwxrwx. 1 root root   2510 Nov 17 13:57 news_readme.html
drwxrwxrwx. 3 root root   4096 Nov 17 13:57 Packages
-rwxrwxrwx. 1 root root   5049 Nov 17 13:57 proxy.php
-rwxrwxrwx. 1 root root  21897 Nov 17 13:57 readme.html
-rwxrwxrwx. 1 root root   1914 Nov 17 13:57 Settings_bak.php
-rwxrwxrwx. 1 root root   2802 Nov 17 13:57 Settings.php
drwxrwxrwx. 5 root root   4096 Nov 17 13:57 Smileys
drwxrwxrwx. 2 root root   4096 Nov 17 13:57 Sources
-rwxrwxrwx. 1 root root  27875 Nov 17 13:57 ssi_examples.php
-rwxrwxrwx. 1 root root   5909 Nov 17 13:57 ssi_examples.shtml
-rwxrwxrwx. 1 root root  74435 Nov 17 13:57 SSI.php
-rwxrwxrwx. 1 root root   8614 Nov 17 13:57 subscriptions.php
drwxrwxrwx. 4 root root   4096 Nov 17 13:57 Themes
[jeff@localhost html]$


The error:

Checking Files are Writable
Some files need to be writable for SMF to work properly. This step allows you to let the installer make them writable for you. However, in some cases it won't work - in that case, please make the following files 777 (writable, 755 on some hosts):

attachments
avatars
cache
Packages
Packages/installed.list
Smileys
Themes
agreement.txt
Settings.php
Settings_bak.php

Sir Osis of Liver

777 doesn't work on some hosts, it's blocked for security reasons.  Directories should be 755, files 644.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

jeffm01

I should have explained in the original message - this is on my personal computer, not a host  ;D

Illori

if you dont know how to fix this then i wonder if you know enough on how to secure the computer/server to prevent it from being hacked.

we really dont recommend using your own pc for a web server unless you really know what you are doing.

shawnb61

I suggest setting permissions as explained above - the directories 755 & files 644.

I would also ensure that the ftp user you are using has sufficient permissions.

If you keep having issues, I'd suggest trying the install from the browser instead of ftp, to see if you have better luck there. 

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

jeffm01

I don't believe I need to secure this computer - it's connected to the internet but I don't open the ports through the router. I also don't run the mysql_secure_installation script.

nginx and mariadb don't start until I issue the systemctl start command.

Since I cannot resolve the issue of file permissions, I will make something from scratch using PHP or Javascript and return to Simple Machines another time. I've had no trouble installing SMF on an actual host.

jeffm01

Easy fix: I had the same issue today with MYBB and the solution is that you must run the chcon command on some files so that the server can write to them via httpd / apache / nginx. The problem here appears to be SELINUX and not permissions. I spent hours tinkering with permissions, adding the files to the apache user and apache group but it didn't work. One chcon command and MYBB installs perfectly, probably the same for Simple Machines.

shawnb61

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

jeffm01

chcon supports a recursive mode which I don't recommend for Simple Machines, but if you're using apache on your local machine you can run this in your /var/www/html directory to get things working, like fwrite() in PHP. It's pretty embarrassing when it doesn't work and I don't know how to fix it!

chcon -R -t httpd_sys_rw_content_t . (in this case that dot is for the current directory)

Don't use -R for simple machines though because it might open a security hole. I got my answer from hxxp:"https://unix.stackexchange.com/questions/50639/httpd-cant-write-to-folder-file-because-of-selinux" [nonactive]. There is also a restore command for chcon settings.

Advertisement: