Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.........
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.
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 08:12 PM.
Reason: Fix up typos
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.