LinuxQuestions.org
Visit Jeremy's Blog.
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 03-26-2006, 03:30 AM   #1
Amr Ebeid
LQ Newbie
 
Registered: Mar 2006
Posts: 1

Rep: Reputation: 0
add user with name.name


hi all
i'm a new user ti linux
how can i add a user the format of (user.familyname)
 
Old 03-26-2006, 03:40 AM   #2
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 164Reputation: 164
On my system (Slackware) you can't create a login name like that, the '.' is an illegal character. However, when you create a user you also add extra information, including a comment field that usually contains the user name. You can put whatever you like in that field. Have you had a look at man useradd
 
Old 03-27-2006, 05:18 PM   #3
Ph0en1x
LQ Newbie
 
Registered: Mar 2006
Location: Kingwood, TX
Distribution: Gentoo
Posts: 5

Rep: Reputation: 0
You might consider using an underscore. (user_familyname)
 
Old 04-01-2006, 05:15 PM   #4
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 469Reputation: 469Reputation: 469Reputation: 469Reputation: 469
Moved: This thread is more suitable in Linux-Newbie and has been moved accordingly to help your thread/question get the exposure it deserves.
 
Old 04-01-2006, 05:42 PM   #5
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 74
Useradd will let you create usernames with dots regardless of distro. Some other tools may not permit you to do this. You would need to do something like
Code:
#useradd -m firstname.surname
 
Old 04-01-2006, 05:52 PM   #6
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 164Reputation: 164
Are you sure about "regardless of distro"? Here's the output on Slackware:
Code:
# useradd joseph.blogs
useradd: invalid user name 'joseph.blogs'
# useradd -m joseph.blogs
useradd: invalid user name 'joseph.blogs'
 
Old 04-01-2006, 06:08 PM   #7
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 74
Quote:
Originally Posted by gilead
Are you sure about "regardless of distro"? Here's the output on Slackware:
Code:
# useradd joseph.blogs
useradd: invalid user name 'joseph.blogs'
# useradd -m joseph.blogs
useradd: invalid user name 'joseph.blogs'
I've just tried it on Gentoo, Suse, CentOS and Debian. It works fine on those distros but I get the same error as you on Arch. It leaves me wondering whether the other distros patch useradd to enable it to accept usernames with dots.
 
Old 04-01-2006, 06:14 PM   #8
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,125

Rep: Reputation: 164Reputation: 164
Quote:
Originally Posted by reddazz
It leaves me wondering whether the other distros patch useradd to enable it to accept usernames with dots.
I'd say you're right - in the shadow sources at http://cvsweb.pld.org.pl/shadow/libm...ame.c?rev=1.11, the user name must match [a-z_][a-z0-9_-]*[$] according to:
Code:
static int good_name (const char *name)
{
	/*
	 * User/group names must match [a-z_][a-z0-9_-]*[$]
	 */
	if (!*name || !((*name >= 'a' && *name <= 'z') || *name == '_'))
		return 0;

	while (*++name) {
		if (!((*name >= 'a' && *name <= 'z') ||
		      (*name >= '0' && *name <= '9') ||
		      *name == '_' || *name == '-' ||
		      (*name == '$' && *(name + 1) == '\0')))
			return 0;
	}

	return 1;
}
 
Old 04-01-2006, 06:23 PM   #9
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 74
One thing to note though is that if have a username with a dot, you cannot use chown or chgrp using dots because they will fail or cause problems. The code below would fail,
Code:
#chown firstname.surname.somegroup somefile
The right syntax would have to be,
Code:
#chown firstname.surname:somegroup somefile
 
Old 11-29-2009, 08:35 AM   #10
Mitio
LQ Newbie
 
Registered: Nov 2009
Posts: 1

Rep: Reputation: 0
workaround

Today i have the same problem with my OS - FC12.
I need to create user: FNAME.LNAME, and when i tried (with and without-m) i received:

useradd: invalid user name

In comparison, in FC11 i haven't such problem.

The workaround i used is to create user manually:
1. create home directory:
Code:
# mkdir /home/FNAME.LNAME
2. adding user TEMPLATEUSER:
Code:
# useradd TEMPLATEUSER
3. change /etc/passwd:
Code:
 # cat /etc/passwd | sed -e "s/TEMPLATEUSER/FNAME.LNAME/g" > /etc/passwd
4. change /etc/group:
Code:
# cat /etc/group | sed -e "s/TEMPLATEUSER/FNAME.LNAME/g" > /etc/group
5. change /etc/shadow:
Code:
# cat /etc/shadow | sed -e "s/TEMPLATEUSER/FNAME.LNAME/g" > /etc/shadow
6. change permition to home directory:
Code:
# chown -R FNAME.LNAME:FNAME.LNAME /home/FNAME.LNAME
Please note, that this is workaround, and you could have problems with script that relay that you haven't dots in your username.

Last edited by Mitio; 11-29-2009 at 08:38 AM.
 
  


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
How to list user in Linux box, add an user to a group! steady_lfcfan Linux - Newbie 12 01-27-2013 02:14 PM
user home dir doesn't create when new user add dev_mohamed Linux - Software 3 01-12-2007 02:08 AM
How to Enable User or Add New User omeryasin Linux - Software 3 10-29-2005 06:16 AM
Help! Cannot Add a User to User Manager or Change Root Password lennysokol Linux - General 2 06-25-2005 10:59 AM
can't add user mister07 Linux - General 5 06-02-2003 12:20 PM


All times are GMT -5. The time now is 07:02 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