{"id":138,"date":"2021-10-15T13:22:02","date_gmt":"2021-10-15T13:22:02","guid":{"rendered":"http:\/\/webhostingpune.co.in\/blog\/?p=138"},"modified":"2021-10-15T13:23:52","modified_gmt":"2021-10-15T13:23:52","slug":"how-to-clear-default-mail-account-in-a-cpanel-server-using-ssh","status":"publish","type":"post","link":"https:\/\/webhostingpune.co.in\/blog\/how-to-clear-default-mail-account-in-a-cpanel-server-using-ssh\/","title":{"rendered":"How to clear Default Mail Account in a cPanel Server using SSH"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In every cPanel server, we can find a default mail account in the name of cPanel username. The default mail account is not used for normal mailing purposes. All the notification mails from the server are forwarded to this default mail account. cPanel also routes mails sent to the non-existing email accounts at your domain name to the default mail account if catch-all feature is enabled. <\/p>\n\n\n\n<p class=\"wp-block-paragraph\">For example, if your default mail account is vasco@demoserver.com and someone emails a non-existent or mistakenly entered address, billy@demoserver.com, then cPanel forwards the email to vasco@demoserver.com. In most cases spam mails are sent to randomly generated email accounts which may or may not exists under a domain. cPanel routes these mails to the default mail account. This increases the disk space usage and is often recommended to clear the mailbox of the default mail accounts.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Default Mailbox Locations<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">There are two directories that need to be cleared under the default mail account. These are the cur and new directories located in the following locations<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/home\/username\/mail\/cur\n\n\/home\/username\/mail\/new<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Clearing these directories will free up disk space on the default mailboxes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Clear Mails with SSH in the Terminal<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Run the following commands in the terminal to delete all recurring mail items in the default mailboxes<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ rm -rf \/home\/username\/mail\/cur\/*\n$ rm -rf \/home\/username\/mail\/new\/*<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The above command stipulates the following:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>rm is the command to remove\/delete items.<\/li><li>-r for recursive removal (typically used with directories)<\/li><li>-f to force the action<\/li><li>-rf is to simply join the two options joined together.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Note: Always check your commands before running in a terminal<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Disk Quota<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">It is important to note that the disk quota will not actually change after removing the mails from the cur and new directories as cPanel caches these values. There is maildirsize file that needs to be deleted or renamed but will automatically be generated again with the correct values.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To delete the file run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ rm -rf \/home\/username\/mail\/maildirsize<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">To rename the file run the following command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ mv \/home\/username\/mail\/maildirsize  \/home\/username\/mail\/maildirsize.old\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Check the Disk Space<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Check the disk space usage to see if the mails has been removed. To see disk usage, navigate to cPanel &gt; Disk Usage<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In every cPanel server, we can find a default mail account in the name of cPanel username. The default mail account is not used for normal mailing purposes. All the notification mails from the server are forwarded to this default mail account. cPanel also routes mails sent to the non-existing email accounts at your domain name to the default mail account if catch-all feature is enabled. For example, if your default mail account is vasco@demoserver.com and someone emails a non-existent or mistakenly entered address, billy@demoserver.com, then cPanel forwards the email to vasco@demoserver.com. In most cases spam mails are sent to randomly generated email accounts which may or may not exists under a domain. cPanel routes these mails to the default mail account. This increases the disk space usage and is often recommended to clear the mailbox of the default mail accounts. Default Mailbox Locations There are two directories that need to be cleared under the default mail account. These are the cur and new directories located in the following locations Clearing these directories will free up disk space on the default mailboxes. Clear Mails with SSH in the Terminal Run the following commands in the terminal to delete all recurring mail items in the default mailboxes The above command stipulates the following: rm is the command to remove\/delete items. -r for recursive removal (typically used with directories) -f to force the action -rf is to simply join the two options joined together. Note: Always check your commands before running in a terminal Disk Quota It is important to note that the disk quota will not actually change after removing the mails from the cur and new directories as cPanel caches these values. There is maildirsize file that needs to be deleted or renamed but will automatically be generated again with the correct values. To delete the file run the following command: To rename the file run the following command Check the Disk Space Check the disk space usage to see if the mails has been removed. To see disk usage, navigate to cPanel &gt; Disk Usage<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-138","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/comments?post=138"}],"version-history":[{"count":2,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/138\/revisions"}],"predecessor-version":[{"id":140,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/posts\/138\/revisions\/140"}],"wp:attachment":[{"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/media?parent=138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/categories?post=138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webhostingpune.co.in\/blog\/wp-json\/wp\/v2\/tags?post=138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}