Solved

Apache Read Write Error

Posted on 2014-09-06
29
315 Views
Last Modified: 2014-09-10
I am having issues with folder permissions:

On applications I keep getting the following errors:
Cannot create folder: /var/www/html/fileserver/temp__vp49720pjqi67i0jsci2lljb56/x_message1

When installing roundcube - save errors.. the read :: write permissions are not working.

I have given the whole HTML (and recursive subfolders) 777 permissions. Is there some other settings?
0
Comment
Question by:Starquest321
  • 17
  • 5
  • 4
  • +3
29 Comments
 
LVL 1

Assisted Solution

by:rwniceing
rwniceing earned 84 total points
ID: 40307611
you install it with root access ?
Did you check the disk space by "df  -h" ?
0
 

Author Comment

by:Starquest321
ID: 40307634
I installed with root access. No issue with disk space.
0
 
LVL 7

Assisted Solution

by:Milind Koyande
Milind Koyande earned 83 total points
ID: 40307851
Is it possible to share the output of
ls -al /var/www/html/
ls -al /var/www/html/fileserver/

Open in new window

0
 

Author Comment

by:Starquest321
ID: 40307947
Note that fileserver is a directory within "application"

[root@s360 ~]# ls -al /var/www/html/
total 88
drwxr-xr-x.  4 root root    95 Sep  5 22:55 .
drwxr-xr-x.  4 root root    31 Sep  5 15:35 ..
-rwxr-xr-x.  1 root root    12 Aug 30 19:33 info.php
-rwxr-xr-x.  1 root root 12288 Aug 30 19:35 .info.php.swn
-rwxr-xr-x.  1 root root 12288 Aug 30 19:32 .info.php.swp
drwxrwxr-x. 24 root root 36864 Sep  5 20:22 application
drwxr-xr-x. 11  501   80  4096 Jan  8  2012 webmail


[root@s360 ~]# ls -al /var/www/html/application/fileserver
total 56
drwxrwxr-x.  2 root root     6 Sep  5 20:21 .
drwxrwxr-x. 24 root root 36864 Sep  5 20:22 ..
[root@s360 ~]#
0
 

Author Comment

by:Starquest321
ID: 40307960
Could it be possible that the permissions on that /var/www/html should be set www-data:root?

I am reading it in various forms, but I don't have a user like that. . .

When I try the command:


[root@s360 ~]# chown -R www-data:root /var/www/html/
chown: invalid user: ‘www-data:root’
0
 
LVL 34

Assisted Solution

by:Seth Simmons
Seth Simmons earned 83 total points
ID: 40308002
I have given the whole HTML (and recursive subfolders) 777 permissions.

based on your output that doesn't appear to be the case; directory permissions are 755

how is this being installed?  if this is being done through a web site installation (as opposed to command line) then whatever user account is running the apache process should have permissions to that folder structure; right now it's only root
if it's the application folder, then change the permissions appropriately
0
 

Author Comment

by:Starquest321
ID: 40308011
I changed back to 755 permissions since I thought that giving www a 777 would be completely careless and insecure. I don't know how this should be done - so I am stuck.
When my application tries to create a directory it's running into the error:

Cannot create folder: /var/www/html/application/temp__474k3qu2rvfkodoin11rvjjgp3/x_message1

What should be the permissions? How do I know which user is trying to run this? Is this a user different than the mysql user?
0
 

Author Comment

by:Starquest321
ID: 40308014
The installation was done using command line while logged in as 'Root'
0
 

Author Comment

by:Starquest321
ID: 40308029
Just read a post that the user trying to access the "html" is actually apache. . . but my ownership is root. So I changed owership :: group to apache. Still no luck.
0
 
LVL 34

Expert Comment

by:Seth Simmons
ID: 40308097
you changed ownership group?  what about user?
directory permissions are 755 so either you change the user also to apache account or change that folder permission to 775 since group rights are r-w thus can't write there
0
 

Author Comment

by:Starquest321
ID: 40308125
This is the current status now:

Seems like both are apache for user and group. But still no luck:

[root@s ~]# ls -al /var/www/html/
total 88
drwxrwxr-x.  4 apache apache    95 Sep  5 22:55 .
drwxr-xr-x.  4 apache apache    31 Sep  5 15:35 ..
-rwxrwxr-x.  1 apache apache    12 Aug 30 19:33 info.php
-rwxrwxr-x.  1 apache apache 12288 Aug 30 19:35 .info.php.swn
-rwxrwxr-x.  1 apache apache 12288 Aug 30 19:32 .info.php.swp
drwxrwxr-x. 24 apache apache 36864 Sep  5 20:22 application
drwxrwxr-x. 11 apache apache  4096 Jan  8  2012 webmail
0
 
LVL 15

Assisted Solution

by:samri
samri earned 83 total points
ID: 40309204
HI,

I am just picking this up from the last few msgs;

>> Cannot create folder: /var/www/html/fileserver/temp__vp49720pjqi67i0jsci2lljb56/x_message1

However, from your ls -al listing above, the folder/path "/var/www/html/fileserver/" does not exist. Maybe you need to check your coding on how the file is written.

Quickest thing that I can think of for now would be to creat the folder;
/var/www/html/fileserver/

or,
/var/www/html/fileserver/temp__vp49720pjqi67i0jsci2lljb56/

And make sure the owner is apache, group is apache.
0
 

Author Comment

by:Starquest321
ID: 40309835
I have made sure that there is a directory called Fireserver.
What is the command to achieve the following:

Can you please give me the specific commands to do the following:

1. Change the "application" directory to the group apache (with all files and subfolders)
2. Give apache write permissions

I have an option to do with this with filizilla.  . .but its not saving. Maybe that is where I am going wrong.

Need urgent help
0
 

Author Comment

by:Starquest321
ID: 40309875
I have ran the following command on the box now:

ls -al /var/www/html/


drwxr-x---.  4 apache apache    95 Sep  5 22:55 .
drwxr-xr-x.  4 apache apache    31 Sep  5 15:35 ..
-rwxr-x---.  1 apache apache    12 Aug 30 19:33 info.php
-rwxr-x---.  1 apache apache 12288 Aug 30 19:35 .info.php.swn
-rwxr-x---.  1 apache apache 12288 Aug 30 19:32 .info.php.swp
drwxrwx---. 24 apache apache 36864 Sep  5 20:22 application
drwxr-x---. 11 apache apache  4096 Jan  8  2012 webmail

The directory: application also is owned by user :: group apache
I noticed that only the group has write permission - but not the user.

How can I change that?
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 34

Expert Comment

by:Seth Simmons
ID: 40309973
I have made sure that there is a directory called Fireserver.

i do not see a fileserver folder in that directory listing; only 5 files

I noticed that only the group has write permission - but not the user.

not an issue since the user account is rwx; only need to change if a different user in the same group needed write access
0
 

Author Comment

by:Starquest321
ID: 40309999
The fileserver directory is inside the "application" ...
I get also general errors when trying to create directories:
Cannot create folder: /var/www/html/application/temp__jceqclgkmptva4qnug8bv34vh7/x_voicemail

The error that I get is from file:
http://192.168.197.130/application/useradd.php

How do I know which user is trying to run the script?
0
 

Author Comment

by:Starquest321
ID: 40310775
Could it be possible that the apache is NOT the user that is running the website?

RIght now I have set for all files in the directory:
-rwxrwx---. 1 apache apache  62620 Sep  6 03:53 text.php

So user, group apache can read, write, execute ... but I still cannot create folder. COuld it be the application is not logging on properly?
0
 
LVL 5

Assisted Solution

by:Dejan Vasiljevic
Dejan Vasiljevic earned 167 total points
ID: 40310798
Hi Starquest321,

I saw the almost same problem as this one. The problem might not be in permissions/rights, but the owner. Try to change temp folder to anything else, like temptemp and it will create it with apache rights, and this should solve Your problem about it.

Thanks,

D.
0
 

Author Comment

by:Starquest321
ID: 40310849
I don't have a "temp" folder. I think it created on the fly.
0
 
LVL 34

Expert Comment

by:Seth Simmons
ID: 40310861
Could it be possible that the apache is NOT the user that is running the website?

ps faux | grep httpd

what is the user account listed?
0
 
LVL 5

Expert Comment

by:Dejan Vasiljevic
ID: 40310877
Starquest,

That is why I said that You need to create it, because it should be owned by user, not by Apache, and that is why You are getting an error. Create a folder and it will temptemp for temp folder and it will give it ownership to apache.

Thanks,

D.
0
 

Author Comment

by:Starquest321
ID: 40310892
ps faux | grep httpd
root      1080  0.0  1.9 516204 20132 ?        Ss   Sep07   0:05 /usr/sbin/httpd -DFOREGROUND
apache    4436  0.0  0.7 342356  7600 ?        S    05:32   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4438  0.0  1.0 518424 10480 ?        S    05:32   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4439  0.0  1.0 518424 10480 ?        S    05:32   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4441  0.0  1.0 518424 10480 ?        S    05:32   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4442  0.0  3.8 543360 38440 ?        S    05:32   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4551  0.0  1.0 518424 10480 ?        S    05:49   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4554  0.0  3.7 543032 38108 ?        S    05:49   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4555  0.0  1.0 518424 10480 ?        S    05:49   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4556  0.0  1.0 518424 10480 ?        S    05:49   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4557  0.0  1.0 518424 10480 ?        S    05:49   0:00  \_ /usr/sbin/httpd -DFOREGROUND
apache    4563  0.0  0.9 518288  9512 ?        S    05:50   0:00  \_ /usr/sbin/httpd -DFOREGROUND
root      4680  0.0  0.0 112640   980 pts/1    S+   06:37   0:00  |       \_ grep --color=auto httpd
0
 

Author Comment

by:Starquest321
ID: 40310900
Dejan: Can you give me specific steps to take?
0
 

Author Comment

by:Starquest321
ID: 40311029
I have created a "new" user .. called "TEMP" to try to solve this issue. Should I put in the group apache to see if this resolves the issue?

The user has "ROOT" rights
0
 
LVL 5

Expert Comment

by:Dejan Vasiljevic
ID: 40311069
Starquest321,

Why did You created new user?

Thanks,

D.
0
 

Author Comment

by:Starquest321
ID: 40311070
Trying anything . . .creating the temp did not do the trick
0
 
LVL 5

Accepted Solution

by:
Dejan Vasiljevic earned 167 total points
ID: 40311079
Did You or did You not updated anything recently ?
0
 

Author Comment

by:Starquest321
ID: 40311088
Not updated anything. . . and if you tell me which commands to check I will.
0
 
LVL 5

Expert Comment

by:Dejan Vasiljevic
ID: 40316009
This is the last message that was probably the solution of this problem and I will post it so the further question have an answer for this, and in future people who search for the same problem could have an example of answer -

"Can You go to Your /tmp folder and create .htaccess file and in there copy this -

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
  # Override the handler again if we're run later in the evaluation list.
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>
# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_flag engine off
</IfModule>
# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_flag engine off
</IfModule>

or for newer version

# Turn off all options we don't need.
Options None
Options +FollowSymLinks

# Set the catch-all handler to prevent scripts from being executed.
SetHandler Drupal_Security_Do_Not_Remove_See_SA_2006_006
<Files *>
  # Override the handler again if we're run later in the evaluation list.
  SetHandler Drupal_Security_Do_Not_Remove_See_SA_2013_003
</Files>

# If we know how to do it safely, disable the PHP engine entirely.
<IfModule mod_php5.c>
  php_flag engine off
</IfModule>

Thanks,

D.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now