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.

For example, hot to set-up the system for john.smith and jsmith to be synonyms?

UPDATE: the reason is than I want a user to be registered in the system as jsmith and to have john.smith@example.com email address.

share|improve this question
    
To what end? Do you want both john.smith and jsmith to have the same permissions? –  Tyler K Jul 9 '10 at 4:29
    
Look into postfix aliases then (Or whatever mail server you're using). You don't need to mess around with OS level users to have a mail alias. If you want to share what mail server you're using, we can get you an actual answer with what you need to do. –  csgeek Jul 13 at 15:38

4 Answers 4

You can't, reliably. Not all auth mechanisms allow for this, either natively or hacked-in.

Now if you don't mind it being an email alias, then just add a line to /etc/aliases and rebuild the alias DB.

share|improve this answer
    
Yes yes, what I actually need is an email alias (but I have never heard of them before as I am just starting my Linux admin career). I need a user login as jsmith and have john.smith@example.com email address. –  Ivan Jul 9 '10 at 4:50
    
So then add john.smith: jsmith. –  Ignacio Vazquez-Abrams Jul 9 '10 at 4:56
    
Not all MTA support /etc/aliases. –  Warner Jul 9 '10 at 13:16

What you looking for is an email alias, not an alias for the user name. Each user in Linux has one and only one name. However, setting up an email server is an entirely different matter. You can set up as many email accounts, with as many aliases to those accounts, as you like. Specifics of doing that are dependent on what your email package is.

share|improve this answer

Add john.smith user to /etc/passwd and set the same home and UID.

share|improve this answer
    
I tried this approach. Not a good idea. It only served to completely confuse my OS –  csgeek Dec 4 '12 at 21:40
    
It may confuse the OS becuase it's against POSIX. It may or may not work. –  Nowaker Dec 5 '12 at 1:35

If you REALLY want to do this. Keep in mind that it's not natively supported nor is it a supported feature.

This is my suggestion:

create a new user and set his $HOME to point to the same directory, then use acl to make him the owner of that folder as well.

something along these lines:

given that user1 exists and userAlias is the new user I'm creating.

sudo useradd userAlias sudo setfacl -m u:userAlias:rwx -R /home/user1

so now userAlias can create files in user1's $HOME. This isn't a perfect solution.. you might have to run a cron to fix the permissions (ie make sure that all files have user and userAlias as the user).

You still have the problem of passwords not being in sync and other silliness to watch out for... but it's theoretically feasible with some ugly hacks.

note: facl is not always standard in all distributions and all kernels. It's been supported by the Linux kernel for ages.. but has been mostly ignored for a long time.

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.