LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-2008, 03:13 PM   #1
pbjams
LQ Newbie
 
Registered: Jan 2008
Posts: 2

Rep: Reputation: 0
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?
 
Old 01-22-2008, 02:27 AM   #2
ravibhure
Member
 
Registered: May 2007
Posts: 75

Rep: Reputation: 15
You need to create bash script for it.
check http://www.indiangnu.org/index.php/archives/59
 
Old 01-23-2008, 10:27 AM   #3
pbjams
LQ Newbie
 
Registered: Jan 2008
Posts: 2

Original Poster
Rep: Reputation: 0
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?
 
Old 01-28-2008, 12:28 AM   #4
ravibhure
Member
 
Registered: May 2007
Posts: 75

Rep: Reputation: 15
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!

Last edited by ravibhure; 01-28-2008 at 12:29 AM.
 
Old 01-28-2008, 03:45 AM   #5
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
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_-.$]).

Last edited by jschiwal; 01-28-2008 at 03:48 AM.
 
Old 01-28-2008, 05:46 AM   #6
ravibhure
Member
 
Registered: May 2007
Posts: 75

Rep: Reputation: 15
I done it in my RHEL 5. so accept it or try for more........
 
Old 01-30-2008, 05:08 PM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
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.
 
Old 01-30-2008, 06:27 PM   #8
dive
Senior Member
 
Registered: Aug 2003
Location: UK
Distribution: Slackware
Posts: 3,232

Rep: Reputation: 299Reputation: 299Reputation: 299
Quote:
Originally Posted by pbjams View Post
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.

Last edited by dive; 01-30-2008 at 06:29 PM.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Automatic login + starting of x gruelius Linux - General 1 02-25-2007 10:27 PM
scripts for starting number lock on for GNOME deepclutch Linux - Software 1 02-23-2007 05:35 PM
create username starting with a number? rmang Red Hat 0 05-13-2005 05:11 PM
starting dc++ from a remote login KOne Linux - Newbie 1 04-20-2004 04:16 PM
cannot login because file system check fails because of bad magic number trutnev Linux - Newbie 1 03-23-2004 07:44 PM


All times are GMT -5. The time now is 04:28 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration