LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   SquirrelMail 1.4.22 cannot create initial preference file Ubuntu Server 18.0.4 (https://www.linuxquestions.org/questions/linux-server-73/squirrelmail-1-4-22-cannot-create-initial-preference-file-ubuntu-server-18-0-4-a-4175669033/)

Callumk 02-05-2020 08:22 AM

SquirrelMail 1.4.22 cannot create initial preference file Ubuntu Server 18.0.4
 
Hey guys, so I know this question has been asked on many different forums - I've looked at tons of them and still can't find the issue.

I have been using the following guide to set up a SquirrelMail server:
https://www.tecmint.com/setup-postfi...ubuntu-debian/

However, when I try to log in, I get the following message:

Error opening ../data/default_pref
Could not create initial preference file!
/var/local/squirrelmail/data/ should be writable by user www-data

I have already gone into the /var/www/html/squirrelmail dir and done the following:

Code:

callum@servpalletloopclub:/var/www/html/squirrelmail$ sudo chown -R www-data:www-data /var/www/html/squirrelmail/
callum@servpalletloopclub:/var/www/html/squirrelmail$ sudo chmod 777 -R /var/www/html/squirrelmail/
callum@servpalletloopclub:/var/www/html/squirrelmail$ sudo chown -R www-data:www-data /var/www/html/squirrelmail/data/
callum@servpalletloopclub:/var/www/html/squirrelmail$ sudo chmod 777 -R /var/www/html/squirrelmail/data/
callum@servpalletloopclub:/var/www/html/squirrelmail$ service dovecot restart
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'dovecot.service'.
Authenticating as: callum
Password:
==== AUTHENTICATION COMPLETE ===
callum@servpalletloopclub:/var/www/html/squirrelmail$ cd data/
callum@servpalletloopclub:/var/www/html/squirrelmail/data$ ls
default_pref  index.php
callum@servpalletloopclub:/var/www/html/squirrelmail/data$ ls -ah
.  ..  default_pref  .htaccess  index.php
callum@servpalletloopclub:/var/www/html/squirrelmail/data$ ls -ltha
total 20K
drwxrwxrwx  2 www-data www-data 4.0K Jul 12  2011 .
drwxrwxrwx 16 www-data www-data 4.0K Jul 12  2011 ..
-rwxrwxrwx  1 www-data www-data  480 Jan  6  2011 index.php
-rwxrwxrwx  1 www-data www-data  41 Feb  7  2007 default_pref
-rwxrwxrwx  1 www-data www-data  14 Mar  2  2002 .htaccess

I don't understand what the www-data user could possibly not have write permissions to - anybody have any ideas?

bathory 02-06-2020 02:26 AM

Quote:

Error opening ../data/default_pref
Could not create initial preference file!
/var/local/squirrelmail/data/ should be writable by user www-data
<snip>
callum@servpalletloopclub:/var/www/html/squirrelmail$ sudo chown -R www-data:www-data /var/www/html/squirrelmail/
callum@servpalletloopclub:/var/www/html/squirrelmail$ sudo chmod 777 -R /var/www/html/squirrelmail/
callum@servpalletloopclub:/var/www/html/squirrelmail$ sudo chown -R www-data:www-data /var/www/html/squirrelmail/data/
callum@servpalletloopclub:/var/www/html/squirrelmail$ sudo chmod 777 -R /var/www/html/squirrelmail/data/
callum@servpalletloopclub:/var/www/html/squirrelmail$ service dovecot restart
<snip
The actual data directory is different than the one you've changed permissions in order to be writable by the apache user
(/var/local/squirrelmail/data instead of /var/www/html/squirrelmail/data)

It's not your fault, but the howto you've followed is not good.
Besides the discrepancies in the directories names it mentions to create users and give them homedir inside the webserver docroot! IMO that's bad practice. Better stick with the default users' dir (like /home/user)
Also it's bad practice to give 777 permissions. Directories need just 755 and files 644

Regards

Callumk 02-06-2020 02:54 AM

Hi Bathory,

Ah I can't believe I didn't spot that, I need to be more diligent next time!


Also yes I agree, I only gave 777 permissions as a test - once I got it working I would have probably changed permissions to 755 as you mentioned.


Thank you for the help anyway :)


This thread can be closed now.

bathory 02-06-2020 03:08 AM

Quote:

Originally Posted by Callumk (Post 6086785)
Hi Bathory,

Ah I can't believe I didn't spot that, I need to be more diligent next time!


Also yes I agree, I only gave 777 permissions as a test - once I got it working I would have probably changed permissions to 755 as you mentioned.


Thank you for the help anyway :)


This thread can be closed now.

Cool! You can use the "Thread Tools" on top of the page to mark the thread solved.

Cheers


All times are GMT -5. The time now is 11:03 AM.