Author Topic: Move /var/vmail to /home/vmail  (Read 276 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
Move /var/vmail to /home/vmail
« on: March 13, 2025, 08:08:19 AM »
Due to lack of space in centos-root, I am trying to change the location of the mail folder from /var/vmail to /home/vmail.

I used this tutorial:
https://wiki.centos-webpanel.com/move-varvmail-to-another-partition

I also changed in /etc/postfix/main.cf
virtual_mailbox_base = /var/vmail
to
virtual_mailbox_base = /home/vmail

And in /etc/dovecot/dovecot.conf
mail_location = maildir:/var/vmail/%d/%n
to
mail_location = maildir:/home/vmail/%d/%n

I restarted postfix and dovecot but when I try to log in to Roundcube, I get the error:
Cannot connect to imap server

Where am I going wrong?
:(

Offline
***
Re: Move /var/vmail to /home/vmail
« Reply #1 on: March 13, 2025, 09:10:03 AM »
1. Make sure dovecot is up and works.

2. Make sure access permissions and owner of the folder:
 /home/vmail
are  correct.

3. Check mail logs to investigate the problem:

/var/log/maillog

4. If you decided to move some system folder to another location then I recommend to follow the steps like:

Code: [Select]
mv /var/vmail /home/
ln -s /home/vmail /var/vmail

Offline
*
Re: Move /var/vmail to /home/vmail
« Reply #2 on: March 13, 2025, 12:29:43 PM »

Instead of mv i've used rsync -av. After that i've double checked and all the files and folders are there and are correct (home/vmail). And have the right permissions  (i've used chmod 770 /home/vmail and chown vmail.mail /home/vmail
Maybe I should also restart cwpsrv, apache and nginx?

Offline
***
Re: Move /var/vmail to /home/vmail
« Reply #3 on: March 13, 2025, 12:39:42 PM »
The access permissions 777 or 770 not always are correct. Some applications/system services check access permissions and if they aren't strict enough the service fails for security reasons.

Check the files/folders inside /home/vmail/DOMAIN.COM. The should belong to "USER:vmail".

No, you don't need to restart cwp,nginx,apache.

Check mail and roundube log files. The log files are the best friend for INVESTIGATION. Currently we are guessing where the problem is.

Offline
*
Re: Move /var/vmail to /home/vmail
« Reply #4 on: March 13, 2025, 03:25:09 PM »
Folders inside /home/vmail belongs to vmail:mail and have permission 700

Offline
*
Re: Move /var/vmail to /home/vmail
« Reply #5 on: March 13, 2025, 05:09:55 PM »
I did a test with one of the folders in /home/vmail
chown -R USER:mail /home/vmail/USER.ro

Then from cpanel I created an email address test@USER.ro

I sent an email that I received.
But the email address is still created in /var/vmail/USER.ro and not in /home/vmail/USER.ro  ???

Offline
***
Re: Move /var/vmail to /home/vmail
« Reply #6 on: March 13, 2025, 06:03:47 PM »
remove /var/vmail and create a symlink from /var/vmail to /home/vmail:
Code: [Select]
rm -rf /var/vmail
ln -s /home/vmail /var/vmail

Offline
*
Re: Move /var/vmail to /home/vmail
« Reply #7 on: March 14, 2025, 07:25:26 AM »
The symbolic link is allready made.
ls -l /var/vmail

Output:
lrwxrwxrwx  1 root     root 11 Mar  9 22:32 vmail -> /home/vmail/

I allreay moved /var/vmail
The folder /var/vmail contains only 2 clients left, The rest of 10 mail clients are allready moved to /home/vmail
But when i accesed an account Roundcube directly from cPanel  (from that 10 account that are allready moved to /home/vmail), it connects to imap but none of the mails are loaded (Inbox empty, Sent, empty)...I should have a lot of e-mails in Inbox and Sent, and phisically exists on /home/vmail/USER

Offline
***
Re: Move /var/vmail to /home/vmail
« Reply #8 on: March 14, 2025, 01:39:50 PM »
Quote
The symbolic link is allready made.

The folder /var/vmail contains only 2 clients left, The rest of 10 mail clients are allready moved to /home/vmail

The link doesn't exist. There could be the symlink OR folder. Check it once again.