LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Adduser with login starting with a number (https://www.linuxquestions.org/questions/linux-newbie-8/adduser-with-login-starting-with-a-number-615262/)

pbjams 01-21-2008 02:13 PM

Adduser with login starting with a number
 
I need to be able to create user accounts that start with numbers. I have tried to research finding different tags that might allow me to force the users account to be created. Can this be done?

ravibhure 01-22-2008 01:27 AM

You need to create bash script for it.
check http://www.indiangnu.org/index.php/archives/59

pbjams 01-23-2008 09:27 AM

Bash script didnt work
 
I created the bash script exactly as you have it but I still can not add a user login like 3xy3y it keeps giving me an error.

# ./adduser
3xy3y

- User names cannot begin with a number; please choose another
Login name for new user []:

Does anyone have any other ideas?

ravibhure 01-27-2008 11:28 PM

Hi,
There is nothing any issue with adduser script. I had tested itself on diff type of OS. Please check it again with abc or xyz (do not start with numeric). After that use numeric start if it success.
Do not copy or paste the given script from http://www.indianGNU.org.
Just write it manually.

[root@indianGNU.org ~]# ./adduser
3xy3y
Changing password for user 3xy3y.
passwd: all authentication tokens updated successfully.

User 3xy3y's password changed!

User 3xy3y will be forced to change password on next login!

jschiwal 01-28-2008 02:45 AM

An account name can't start with a letter. That is an invalid account name.

Quote:

DESCRIPTION
useradd creates a new user account using the default values from /etc/default/useradd and the specified
on the command line. Depending on the command line options the new account will be added to the system
files or LDAP database, the home directory will be created and the initial default files and directories
will be copied.

The account name must begin with an alphabetic character and the rest of the string should be from the
POSIX portable character class ([A-Za-z_][A-Za-z0-9_-.]*[A-Za-z0-9_-.$]).

ravibhure 01-28-2008 04:46 AM

I done it in my RHEL 5. so accept it or try for more........

jschiwal 01-30-2008 04:08 PM

Sounds like a bug. I don't think it is allowed for posix compliance. There isn't a compelling reason to want to do it anyway.

dive 01-30-2008 05:27 PM

Quote:

Originally Posted by pbjams (Post 3032589)
User names cannot begin with a number; please choose another
Login name for new user []:

Does anyone have any other ideas?

I think there's a clue in the output. Some systems might allow usernames beginning with a number, but yours doesn't.

P.S. No amount of bash scripting will change that. You could try editing the user/group/password/shadow files manually but on your own head be it.


All times are GMT -5. The time now is 03:15 PM.