how to remove / deleted all email forwarders from particular domain ??

crazyaboutlinux

Well-Known Member
Nov 3, 2007
939
1
66
we have a domain which has 2000 numbers of email forwarders created & which want to remove them.

how to remove / deleted all email forwarders from particular domain at one go ?
 

JawadArshad

Well-Known Member
PartnerNOC
Apr 8, 2008
459
7
68
PK
cPanel Access Level
DataCenter Provider
Yes. Rather than deleting the file, you could move the file into the user's home folder as it would have been a quite an effort to add so many forwarders. ;)

do i just need to enter only /etc/valiases/${domain} (replace with actual domain) from SSH ??
 
Last edited:

crazyaboutlinux

Well-Known Member
Nov 3, 2007
939
1
66
Yes. Rather than deleting the file, you could move the file into the user's home folder as it would have been a quite an effort to add so many forwarders. ;)
I have tried but it gives an error
Code:
[email protected] [~]# /etc/valiases/$example.net
-bash: /etc/valiases/example.net: No such file or directory
[email protected] [~]# cd /etc/valiases/
[email protected] [/etc/valiases]# /etc/valiases/$example.net
-bash: /etc/valiasesexample.net: No such file or directory
[email protected] [/etc/valiases]# /etc/valiases/${example.net}
-bash: /etc/valiases/${example.net}: bad substitution
[email protected] [/etc/valiases]#
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello Nilesh,

You cannot directly enter the file name without a corresponding command before it. If you want to move the file, you can do:

Code:
cd /etc/valiases
mv domain.com /home/user/domain.com
Here you are changing directory (cd) to /etc/valiases, then moving (mv) the domain's forwarder file to the user's home location. Replace domain.com with the domain in question and replace user with the cPanel account's username.

I did want to mention that vi isn't necessary to see the contents of a file also. You can use cat:

Code:
cat /etc/valiases/domain.com
Thanks.
 

rhenderson

Well-Known Member
Apr 21, 2005
784
2
168
Oklahoma
cPanel Access Level
Root Administrator
we have a domain which has 2000 numbers of email forwarders created & which want to remove them.

how to remove / deleted all email forwarders from particular domain at one go ?
I would install ConfigServer Mail Manage and do it from there, it will show the forwarders in a text file you can cut and past save it before you delete them ConfigServer Mail Manage