Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 01-21-2012, 08:27 AM   #1
LQ Newbie
Registered: Feb 2004
Distribution: Debian 3.x etch (testing)
Posts: 24

Rep: Reputation: 0
Question Case-insensitive User Name Creation


I am having a go at setting up an e-mail server using CentOS 6.2 running under VirtualBox. I have never done this before, only previously using Linux as a desktop OS.

So I installed CentOS, using a "minimal" install with the "E-mail Server" option selected. postfix and dovecot are available. I also installed mailx for testing.

I can send an e-mail to "root" and this will appear in /var/mail/root. However, after creating a user with my forum username and trying to send e-mail to that, nothing seems to happen. Examining /var/log/maillog shows that the e-mail bounced due to an unknown user "smurf7".

Reading around this, it seems that postfix converts the requested user name into lowercase before looking anywhere (putting "smurf7:SMurf7" into \etc\aliases and running newaliases didn't fix it). Short of butchering the code, there is little I can do about that.

Most people also infer that creating usernames with uppercase letters is bad form, yet adduser did not complain when I did it.

Is there a way that I can force adduser to treat all usernames as lowercase, preventing duplicate names in different case (and allowing e-mail to work)?
Old 01-21-2012, 05:00 PM   #2
Registered: Aug 2005
Location: Brazil
Distribution: Debian Jessie
Posts: 791

Rep: Reputation: 76
Well, you could make a wrapper: (lowercase adduser):


LCUSER=`echo $1 | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
adduser $LCUSER
# lcadduser SMurf7
Or something like that. Though it's probably not the "proper" way to handle your problem.
Old 01-22-2012, 05:25 AM   #3
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian + kde 4 / 5
Posts: 6,834

Rep: Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976Reputation: 1976
No need to use tr for this in modern versions of bash. It has built-in case conversion.

adduser "${1,,}"
parameter substitution

But first take a look at man adduser.conf for details on the NAME_REGEX value. According to mine, the default value is set to accept lowercase-only anyway.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to make case insensitive when authz user on Subversion chobong Linux - Software 3 07-05-2010 04:52 AM
Checking of Case insensitive gregarion Programming 5 01-20-2010 12:09 AM
Apache Case Insensitive RiceAnis Red Hat 4 12-03-2009 09:45 AM
Copying files from case-sensitive Linux to case-insensitive Windows via CIFS? SlowCoder Linux - General 4 05-07-2008 08:03 PM
Case-insensitive CVS? sundialsvcs Programming 2 06-25-2006 11:01 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration