LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 01-21-2012, 07:27 AM   #1
SMurf7
LQ Newbie
 
Registered: Feb 2004
Distribution: Alpine Linux 3.18
Posts: 27

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


Hello,

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, 04:00 PM   #2
lucmove
Senior Member
 
Registered: Aug 2005
Location: Brazil
Distribution: Debian
Posts: 1,432

Rep: Reputation: 110Reputation: 110
Well, you could make a wrapper:

lcadduser.sh (lowercase adduser):

Code:
#!/bin/bash

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

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

Code:
#!/bin/bash
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.
 
  


Reply



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 03:52 AM
Checking of Case insensitive gregarion Programming 5 01-19-2010 11:09 PM
Apache Case Insensitive RiceAnis Red Hat 4 12-03-2009 08:45 AM
Copying files from case-sensitive Linux to case-insensitive Windows via CIFS? SlowCoder Linux - General 4 05-07-2008 07:03 PM
Case-insensitive CVS? sundialsvcs Programming 2 06-25-2006 10:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:53 AM.

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