Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File/Folder Permissions #4

Open
wilsonge opened this issue Oct 12, 2013 · 23 comments
Open

File/Folder Permissions #4

wilsonge opened this issue Oct 12, 2013 · 23 comments

Comments

@wilsonge
Copy link

For the web script it would be awesome to have a point about setting file permissions. been struggling to fix creating files/folder permissions for Joomla for the last 30/45 mins minutes!

@betweenbrain
Copy link
Owner

@betweenbrain
Copy link
Owner

If it is that script, you shouldn't have any permission issues as you are running Apache as you, not www-data That is the main reason for doing so.

@wilsonge
Copy link
Author

I've been using this one for a lamp stack: https://github.com/betweenbrain/linux-stuff/tree/master/ubuntu-web-dev-setup but on lubuntu? Joomla won't create a config file, FOF can't create a folder for caching stuff etc.

@betweenbrain
Copy link
Owner

It does sound like Apache is not running as you, or maybe the public_html is owned by root. Check out http://serverfault.com/questions/125865/finding-out-what-user-apache-is-running-as .

Also, try running the following commands, as root, with replacing $USER with your username.

chown -R $USER:$USER /home/$USER/public_html
find /home/$USER/public_html/ -type d -exec chmod 755 {} ;
find /home/$USER/public_html/ -type f -exec chmod 644 {} ;

@wilsonge
Copy link
Author

root     11404  0.0  0.1 231672 10164 ?        Ss   23:07   0:00 /usr/sbin/apache2 -k start
www-data 11409  0.0  0.1 232024 10216 ?        S    23:07   0:00 /usr/sbin/apache2 -k start
www-data 11410  0.0  0.1 232024 10216 ?        S    23:07   0:00 /usr/sbin/apache2 -k start
www-data 11411  0.0  0.1 232024 10216 ?        S    23:07   0:00 /usr/sbin/apache2 -k start
www-data 11412  0.0  0.1 232024 10212 ?        S    23:07   0:00 /usr/sbin/apache2 -k start
www-data 11413  0.0  0.1 232024 10212 ?        S    23:07   0:00 /usr/sbin/apache2 -k start
www-data 11414  0.1  0.1 236112 14948 ?        S    23:07   0:00 /usr/sbin/apache2 -k start
www-data 11416  0.0  0.1 232024 10200 ?        S    23:07   0:00 /usr/sbin/apache2 -k start
www-data 11417  0.0  0.1 235144 13876 ?        S    23:07   0:00 /usr/sbin/apache2 -k start
www-data 11419  0.0  0.1 232024 10200 ?        S    23:07   0:00 /usr/sbin/apache2 -k start
www-data 11420  0.0  0.1 232024 10200 ?        S    23:07   0:00 /usr/sbin/apache2 -k start
user     19816  0.0  0.0  20428   956 pts/0    R+   23:21   0:00 egrep --color=auto (apache|httpd)

It looks like root has control unforunately :( but your commands above there don't seem to make any difference. I'd already tried the latter 2 before actually.

I also checked my httpd.conf file and it seemed to be fine from the instructions

@betweenbrain
Copy link
Owner

Yes, Apache is not running under your user account, which is the root cause of the issue.

Can you post the contents of /etc/apache2/httpd.conf

@wilsonge
Copy link
Author

ServerName localhost
User user
Group user

Contents of that file. user being the username of the only user account i have set up for linux

@betweenbrain
Copy link
Owner

Is "user" your username? I'd not, you need to replace user with your real
user's name.

Best,

Matt Thomas
Founder betweenbrain™
Lead Developer Construct Template Development Framework
Phone: 203.632.9322
Twitter: @betweenbrain
Github: https://github.com/betweenbrain

Sent from mobile. Please excuse any typos and brevity.
On Oct 15, 2013 7:45 AM, "George Wilson" [email protected] wrote:

ServerName localhost
User user
Group user


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-26327444
.

@wilsonge
Copy link
Author

Yup user is the username of the account (thanks to the pc shop who did the initial setup)

@betweenbrain
Copy link
Owner

Can you post the output from $ whoami and $ groups

@wilsonge
Copy link
Author

$ groups: user adm cdrom sudo dip plugdev lpadmin sambashare
$ whoami: user

@betweenbrain
Copy link
Owner

Odd, that should work. Do you get any error messages when running $ sudo /etc/init.d/apache2 restart ?

@wilsonge
Copy link
Author

There is a warning - but no errors. Warning:

* Restarting web server apache2                                                [Tue Oct 15 14:14:32 2013] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting [Tue Oct 15 14:14:33 2013] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                         [ OK ]

@betweenbrain
Copy link
Owner

I susect the issue is with apache2: Could not reliably determine the server's fully qualified domain name and not ever reading the User and Group directve. Try commenting out line 1 of /etc/apache2/httpd.conf and restart Apache to see if those warnings go away. If so, then try ps -ef | grep httpd | head -n1 | awk '{print $1}'

@wilsonge
Copy link
Author

OK i removed it. Still get a warning though:

[Tue Oct 15 14:27:38 2013] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting [Tue Oct 15 14:27:39 2013] [warn] The Alias directive in /etc/phpmyadmin/apache.conf at line 3 will probably never match because it overlaps an earlier Alias.
apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName

Running that command just gives me user

@betweenbrain
Copy link
Owner

So then, try reverting the last change to /etc/apache2/httpd.conf and then comment out /etc/phpmyadmin/apache.conf at line 3 and see if that resolves it.

@wilsonge
Copy link
Author

OK done that when restarting seems OK now

sudo /etc/init.d/apache2 restart
 * Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                         [ OK ]

However still no file permissions. However I found adding those details to apache2.conf rather than httpd.conf (which I'd had to create - although the interweb said often you do) solved the issue as in I got this:

user     28857  0.2  0.1 470492 14868 ?        Sl   20:40   0:00 leafpad /etc/apache2/httpd.conf
user     28870  1.4  0.2 505988 16168 ?        Sl   20:40   0:00 gksu pcmanfm /etc/apache2
root     28873  0.0  0.0  65256  2224 ?        Ss   20:40   0:00 /usr/bin/sudo -H -S -p GNOME_SUDO_PASS -u root -- pcmanfm /etc/apache2
root     28875  1.2  0.2 537276 17404 ?        S    20:40   0:00 pcmanfm /etc/apache2
root     28925  0.1  0.1 231672 10132 ?        Ss   20:41   0:00 /usr/sbin/apache2 -k start
user     28930  0.0  0.0 231704  6156 ?        S    20:41   0:00 /usr/sbin/apache2 -k start
user     28931  0.0  0.0 231704  6156 ?        S    20:41   0:00 /usr/sbin/apache2 -k start
user     28932  0.0  0.0 231704  6156 ?        S    20:41   0:00 /usr/sbin/apache2 -k start
user     28933  0.0  0.0 231704  6156 ?        S    20:41   0:00 /usr/sbin/apache2 -k start
user     28934  0.0  0.0 231704  6156 ?        S    20:41   0:00 /usr/sbin/apache2 -k start
user     28946  0.0  0.0  20428   956 pts/0    S+   20:41   0:00 egrep --color=auto (apache|httpd)

However apache then refused to restart. Which clearly was a real pita.

So I'm wondering does there need to be some specific inclusion of the httpd.conf file in the apache2.conf file? which is where we're ending up with the issue?

@betweenbrain
Copy link
Owner

Now that Apache is running under the correct user, try these again

sudo chown -R user:user /home/user/public_html
sudo find /home/user/public_html/ -type d -exec chmod 755 {} \;
sudo find /home/user/public_html/ -type f -exec chmod 644 {} \;

Yes, you do need to create /etc/apache2/httpd.conf as it is not a system file (some distros have an empty one).

Now, is Apache running or not?

@wilsonge
Copy link
Author

It does if root has permissions and it doesn't if user has permissions. ran those commands again and no joy.

@wilsonge
Copy link
Author

ps aux | egrep '(apache|httpd)' gives

root      8366  0.0  0.1 231672 10160 ?        Ss   23:12   0:00 /usr/sbin/apache2 -k start
www-data  8371  0.0  0.0 231704  6156 ?        S    23:12   0:00 /usr/sbin/apache2 -k start
www-data  8372  0.0  0.0 231704  6156 ?        S    23:12   0:00 /usr/sbin/apache2 -k start
www-data  8373  0.0  0.0 231704  6156 ?        S    23:12   0:00 /usr/sbin/apache2 -k start
www-data  8374  0.0  0.0 231704  6156 ?        S    23:12   0:00 /usr/sbin/apache2 -k start
www-data  8375  0.0  0.0 231704  6156 ?        S    23:12   0:00 /usr/sbin/apache2 -k start
user      8425  0.0  0.0  20428   952 pts/0    S+   23:13   0:00 egrep --color=auto (apache|httpd)

restarting apache gives:

user@user-System-Product-Name:~/public_html$ sudo /etc/init.d/apache2 restart
 * Restarting web server apache2                                                apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
 ... waiting apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName
                                                                         [ OK ]

@betweenbrain
Copy link
Owner

There is obviously something wrong with your Apache configuration, but unfortunately, I'm not sure what else to suggest other than reviewing the tutorial step by step and see if you missed a step. Maybe even launch a VM and reproduce the steps by using https://github.com/betweenbrain/linux-stuff/tree/master/xubuntu-12.04-web-dev-setup.

On a related note, I do wonder how using user as a username may effect things. Might be worth looking into. Did the pc shop that did the initial install do instal anything other than the OS? Any extra packages?

@wilsonge
Copy link
Author

gahh. right will go through it again and triple check everything. thanks for all the advice :)

I have no clue. I'm not sure what is 'supposed' to come with lubuntu. I don't think so though. As far as what I understood they just loadtested the PC for 24 hours before they handed it over to me as custom build pc's are most likely to break in 1st 24 hours

@betweenbrain
Copy link
Owner

I'm really sorry to say that. I've used these tutorials to build many
boxes, but always from scratch. Maybe they installed the LAMP package
causing conflicts. It's unfortunately very hard for me to know from here.

Best,

Matt Thomas
Founder betweenbrain™
Lead Developer Construct Template Development Framework
Phone: 203.632.9322
Twitter: @betweenbrain
Github: https://github.com/betweenbrain

Sent from mobile. Please excuse any typos and brevity.
On Oct 16, 2013 8:31 PM, "George Wilson" [email protected] wrote:

gahh. right will go through it again and triple check everything. thanks
for all the advice :)

I have no clue. I'm not sure what is 'supposed' to come with lubuntu. I
don't think so though. As far as what I understood they just loadtested the
PC for 24 hours before they handed it over to me as custom build pc's are
most likely to break in 1st 24 hours


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-26470960
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants