LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-19-2008, 11:27 PM   #1
deepsix
Member
 
Registered: Apr 2003
Distribution: ANY
Posts: 339

Rep: Reputation: 32
Just curious....about usernames


I was just wondering if any linux vets out there could explain why we cant create a username begining with a capital letter or number?

Or if there is a way to get it to work somehow...

any input would be appreciated.
 
Old 10-20-2008, 02:21 AM   #2
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 655

Rep: Reputation: 40
Good question. I'd like to know the answer myself.
 
Old 10-20-2008, 02:38 AM   #3
danboland
Member
 
Registered: Feb 2006
Location: NJ, USA
Distribution: Debian
Posts: 72

Rep: Reputation: 17
You can if you want:
Code:
root:~# useradd TEST
root:~# su TEST
sh-3.1$ id
uid=5004(TEST) gid=5008(TEST) groups=5008(TEST)
Code:
root:~# useradd 4TEST
root:~# su 4TEST
sh-3.1$ id
uid=5005(4TEST) gid=5009(4TEST) groups=5009(4TEST)
sh-3.1$
however if you do it this way you will get a warning, and a way to bypass the warning:
Code:
root:dan# adduser TEST
adduser: Please enter a username matching the regular expression configured
via the NAME_REGEX configuration variable.  Use the `--force-badname'
option to relax this check or reconfigure NAME_REGEX.

The reason why you shouldn't do it is because not all utilities that run on the system use case sensitive naming. for instance, FTP, sendmail, and Samba.

It would also be an administration nightmare with lots of users. so the genral rule is to just say, always use lowercase.

The no numbers is most likely the same reason, certain services can not have the letters in the front as they may take on special meanings.


Dan
 
Old 10-20-2008, 03:19 AM   #4
deepsix
Member
 
Registered: Apr 2003
Distribution: ANY
Posts: 339

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by danboland View Post
You can if you want:
Code:
root:~# useradd TEST
root:~# su TEST
sh-3.1$ id
uid=5004(TEST) gid=5008(TEST) groups=5008(TEST)
Code:
root:~# useradd 4TEST
root:~# su 4TEST
sh-3.1$ id
uid=5005(4TEST) gid=5009(4TEST) groups=5009(4TEST)
sh-3.1$
however if you do it this way you will get a warning, and a way to bypass the warning:
Code:
root:dan# adduser TEST
adduser: Please enter a username matching the regular expression configured
via the NAME_REGEX configuration variable.  Use the `--force-badname'
option to relax this check or reconfigure NAME_REGEX.

The reason why you shouldn't do it is because not all utilities that run on the system use case sensitive naming. for instance, FTP, sendmail, and Samba.

It would also be an administration nightmare with lots of users. so the genral rule is to just say, always use lowercase.

The no numbers is most likely the same reason, certain services can not have the letters in the front as they may take on special meanings.


Dan


thanks....
just curious ......why uid=5005(4TEST) gid=5009(4TEST) groups=5009(4TEST)
and why uid's matter..........
why gid's matter........
why groups matter.....
i just want to change a username.........
 
Old 10-20-2008, 07:37 AM   #5
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 655

Rep: Reputation: 40
The ID's are, unless given as an option to the useradd command, auto generated. The ID's are sequential, so the next UID would be 5004.

It seems like the GID 5004 was taken, so the next available GID was 5008.

If you change a UID or GID if think you will see problems with files. Files are owned by a UID and GID, and changing the GID/UID of a user doesn't automatically change the ID's of the files.
 
Old 10-20-2008, 03:24 PM   #6
NyteOwl
Member
 
Registered: Aug 2008
Location: Nova Scotia, Canada
Distribution: Slackware, OpenBSD, others periodically
Posts: 512

Rep: Reputation: 139Reputation: 139
UID's GID's groups matter because Linux is a multiuser system and those items are part of the management structure in a multiuser system.

As an aside, not a particularly friendly signature you have there deepsix.
 
Old 10-20-2008, 09:05 PM   #7
deepsix
Member
 
Registered: Apr 2003
Distribution: ANY
Posts: 339

Original Poster
Rep: Reputation: 32
As an aside, not a particularly friendly signature you have there deepsix.[/QUOTE]


well...
 
Old 10-20-2008, 09:54 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,418

Rep: Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398Reputation: 2398
To expand on kenneho & NyteOwl, its important to remember that (as far as files etc are concerned), the system actually uses id, not username (similarly to the fact that the net actually uses ip addresses, not www.blah.com).
Names are just a convenience for us.
Eg if you restore files for a user that no longer exists, the uid (& possibly gid) will show in the ls cmd, not their name/group.
That's why you see both in /etc/passwd, /etc/group, as a x-ref.

Last edited by chrism01; 10-22-2008 at 09:12 PM. Reason: Fix up typos
 
Old 10-21-2008, 02:44 AM   #9
danboland
Member
 
Registered: Feb 2006
Location: NJ, USA
Distribution: Debian
Posts: 72

Rep: Reputation: 17
they all pretty much summed it up, and yes, i have more groups then users so that counter got incremented faster; doesn't mean a thing though
 
Old 10-21-2008, 03:02 AM   #10
billymayday
LQ Guru
 
Registered: Mar 2006
Location: Sydney, Australia
Distribution: Fedora, CentOS, OpenSuse, Slack, Gentoo, Debian, Arch, PCBSD
Posts: 6,678

Rep: Reputation: 122Reputation: 122
Quote:
Originally Posted by NyteOwl View Post
As an aside, not a particularly friendly signature you have there deepsix.
And missing an apostrophe
 
Old 10-22-2008, 02:07 AM   #11
deepsix
Member
 
Registered: Apr 2003
Distribution: ANY
Posts: 339

Original Poster
Rep: Reputation: 32
Quote:
Originally Posted by danboland View Post
they all pretty much summed it up, and yes, i have more groups then users so that counter got incremented faster; doesn't mean a thing though
thanks for all the info guys...I really appreciate it....
I wonder if it would be hard to implement some sort of filter that would take a username like 666 (just an example) and before it gets parsed or whatever runs through a filter to make it be the username hell
so that way you would have a user name hell with uid gid and all that but he could have the option of logging in as 666 999 or 316? I know this sounds redundant but the idea came to me after 6 beers and a plot to take over the world...lol
j/k
thanks for all the input.

p.s. would sort of be like windows 98 guest login i suppose.

Last edited by deepsix; 10-22-2008 at 02:33 AM.
 
Old 10-23-2008, 09:30 AM   #12
kenneho
Member
 
Registered: May 2003
Location: Oslo, Norway
Distribution: Ubuntu, Red Hat Enterprise Linux
Posts: 655

Rep: Reputation: 40
Quote:
Originally Posted by deepsix View Post
thanks for all the info guys...I really appreciate it....
I wonder if it would be hard to implement some sort of filter that would take a username like 666 (just an example) and before it gets parsed or whatever runs through a filter to make it be the username hell
so that way you would have a user name hell with uid gid and all that but he could have the option of logging in as 666 999 or 316? I know this sounds redundant but the idea came to me after 6 beers and a plot to take over the world...lol
j/k
thanks for all the input.

p.s. would sort of be like windows 98 guest login i suppose.
That would be cool. I guess it could be done by making a "wrapper" script around the "useradd" command: Input is give to you script, then your script does whatever (like change the username), which again call the "useradd" command.
 
  


Reply


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
why no usernames in /etc/group?? lrt Linux - Server 4 03-18-2008 12:02 PM
For those with imaginative usernames . . . polarbear20000 General 58 05-24-2007 11:43 AM
unhidden usernames? Cyran Linux - Security 1 09-29-2006 03:38 AM
usernames with dots yang11 Linux - Enterprise 2 03-18-2005 08:07 AM
Usernames Zwitterion Linux - General 1 12-25-2002 09:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 01:23 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration