Squirrelmail Error With Ispconfig

If you have installed ispconfig by following http://www.howtoforge.com/  then you have also installed squirrel mail. You may face attachment problem, Saying data directory is not writable. Here is the solution.

Squirrelmail_Error_With_Ispconfig

First in terminal run this command:

squirrelmail-configure

choose 4 (General Options) and press Enter.

Check the directories.

Squirrelmail_Error_With_Ispconfig-Data_and_Attachment_Directory

Type “Q” to quit.

Now Check the user:group of data folder.

ls -la /var/lib/squirrelmail/data/

Use www-data (if you are using nginx and ispconfig and you don’t wanna give permission to any other vhost to access squirrelmail then you have to use ispconfig:ispconfig instead of www-data:www-data ).

chown -R www-data:www-data /var/lib/squirrelmail/data/

Now give read-write access.

chmod 733 -R /var/lib/squirrelmail/data/

Now create an attachment page in “/usr/share/squirrelmail/”

mkdir -p /usr/share/squirrelmail/attach

Set permission.

chmod 733 -R /usr/share/squirrelmail/attach

Now make sure you have created the “tmp” directory.

mkdir /var/lib/squirrelmail/tmp

and permission is set to “www-data” group.

chown www-data /var/lib/squirrelmail/tmp

Now restart nginx

service nginx restart

or Restart Apache

service apache2 restart

Now again set squirrelmail configuration.

squirrelmail-configure

choose 4 (General Options) and press Enter. Again press 2(Attachment Directory) and then put this-

/usr/share/squirrelmail/attach

Press enter and then save by “S” and quit by “Q”. Now everything should be ok. Let me know if i have mistaken.

 Whole procedure can be done by a simple command as i have created a shell script which can be executed to give the solution without much headache.

wget --no-check-certificate https://fahadahammed.com/extras/squirrelmail_upload_error_solution.sh -O squirrelmail_upload_error_solution.sh;chmod +x squirrelmail_upload_error_solution.sh;bash squirrelmail_upload_error_solution.sh;rm squirrelmail_upload_error_solution.sh

The code is:

#!/bin/bash
#####################################################################
# SquirrelMail Error - Could not move/copy file. File not attached.  #
#####################################################################
chown -R www-data:www-data /var/lib/squirrelmail/data/
chmod 733 -R /var/lib/squirrelmail/data/
mkdir -p /usr/share/squirrelmail/attach
chmod 733 -R /usr/share/squirrelmail/attach
mkdir /var/lib/squirrelmail/tmp
chown www-data /var/lib/squirrelmail/tmp
sed -i '65s//var/spool/squirrelmail/attach//usr/share/squirrelmail/attach/' /etc/squirrelmail/config.php
service nginx restart
service apache2 restart

That is it. Hope it will solve your problem. 🙂

Thank You.