Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm trying to create a user "mail" in my fresh VPS (Debian 6), so I can use the email address mail@mydomain, but I receive the error

useradd: user 'mail' already exists

Indeed, /etc/passwd contains the line

mail:x:8:8:mail:/var/mail:/bin/sh

Can I set the password, login and use it for my personal email?

share|improve this question
    
Why would you set your personal email name to "mail"? Why wouldn't you use your own username? –  Bart Silverstrim Jan 13 '12 at 13:17
    
Because mydomain is already my name. –  eze Jan 13 '12 at 13:22
    
The user "mail" exists. Make your username username@mydomain.com for email, not "mail." –  Bart Silverstrim Jan 13 '12 at 13:25

3 Answers 3

up vote 2 down vote accepted

Because "mail" refers to a server application on the system and is already in the system as a component in your mail system, I'd highly advise against using it. Even if you were to alias the incoming mail, it would add unnecessary complication to your setup.

Use your actual username, or pick another name like "email" or "contact" and use that instead. Otherwise you're asking for trouble down the road.

share|improve this answer
    
Thanks. As I'm clearly a beginner, could anybody point me to documentation that explains why those components need to be users in a UNIX system? –  eze Jan 13 '12 at 13:27
    
Because your mail system needs access to the mail spool, most likely (depending on setup) and the mail spool will be owned by that user. The program is running as itself for security purposes because if it is compromised and running with root privileges it would allow an attacker root access. Instead it's limited to just the email system. –  Bart Silverstrim Jan 13 '12 at 13:35
    
Nonsense. Mail is a user - and by default most MTAs will map mailbox names directly to usernames - but it doesn't have to. In this instance 'mail' only refers to user as which some of the mail components may run as. It's not a "server application" –  symcbean Jan 13 '12 at 16:22
    
@symcbean - Not nonsense. I have a binary called mail no my system, and on some I've used it's a component to the mail system, while other parts of the mail system also use that username. I wasn't going to turn this into a whole HOWTO just to answer his question, I was trying to give a brief overview of why it would be done without delving into every MTA and distro permutation on the planet. Why would they need to be users? Because your mail server and mail subsystem needs to work as a user with permissions to its own logs, spool, etc. without compromising security. –  Bart Silverstrim Jan 13 '12 at 16:28
    
If he'd like to post what his specific distro and MTA are, then someone else can get into a specific diagram of how exactly his precise system works with that configuration, as there are many cases where someone else's configuration won't match mine. –  Bart Silverstrim Jan 13 '12 at 16:28

If you want to receive email addressed to mail@yourdomain then you just need to tell your email system to deliver it to your mailbox and not to that of the user 'mail'

Most MTAs will allow you to change the map a mailbox name to a different username without much effort - indeed, its possible on every MTA but difficult to do on some. Also, nearly every MTA (and MDA) provides a mechanism for forwarding email to a different mailbox.

However you've provided no details of what MTA nor MDA is deployed.

Can I set the password, login and use it for my personal email?

This is not the way to solve the problem. Server processes uses run under discreate uids for a very good reason - privilege seperation - and a an account used for running a server process should never be used for other purposes.

share|improve this answer

In case anybody is interested in this topic, I have found (in Debian) a way to make things work, in my eyes, quite elegantly. Since accounts are internally referenced by UIDs, the names are in a sense mere aliases. Just as root always has UID 0, mail generally has UID 8 (the actual UID we don't need to know). We can change the name of the user account with UID 8 thus:

usermod -l smail mail

All in all, something like this works:

usermod -l smail mail    
groupmod -n smail mail
groupadd mail
useradd -m -s /bin/bash -g mail -c 'Your Name' mail

(Again in Debian, /etc/default/useradd ought to have the line # CREATE_MAIL_SPOOL=yes uncommented.)

If I find some crazy unexpected behavior as a result I will update this old post. Cheers!

Side note: In general it is not necessary to do groupadd user manually in order to useradd user: you simply omit the -g option. However, this gives an error. Indeed, there is something special about the name/alias mail, so... be careful if you feel like trying this!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.