Linux – How to create email accounts via SSH

emaillinuxmailboxsshvps

I’m contemplating purchasing a VPS solution from my current hosting provider. They offer a cPanel installation (which I’ve used on shared and reseller hosting accounts for years now), however, I’m responsible for the licence fee in a VPS package and it’s quite a chunk to pay per year.

So my question is: if I were to opt for a VPS package and forego the cPanel installation, how would I then manage mailboxes? I know how to create virtual hosts under Apache, so serving websites doesn’t faze me (and I’m planning on managing website source code via version control), but it’s the additional tasks to managing a web presence such as setting up email accounts that I’m not familiar with. Can setting up a mailbox be done via SSH?

Best Answer

It's trivially easy to do that with a UNIX MTA, eg sendmail, if you don't mind each email address being associated with an actual user on your system (make the user with useradd; put the aliases in /etc/aliases and run newaliases).

I applaud your decision to get out from under the thumb of cpanel, and I reckon you should be fine doing this if you're OK with hacking virtual hosts into your apache config, which (imho) is a lot fiddlier.

Edit: I wouldn't look for "resources for managing hosting via ssh", because a lot of UNIX guides either take it for granted that you're doing everything from the shell (ie, command line, via SSH), or provide shell alternatives to everything graphical, anyway. If I were you I'd start with the official documentation for whatever distro you're running on your VPS. If you say what that distro is, people may have other good pointers for you.