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) |
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
|
You might consider using an underscore. (user_familyname)
|
Moved: This thread is more suitable in Linux-Newbie and has been moved accordingly to help your thread/question get the exposure it deserves.
|
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 |
Are you sure about "regardless of distro"? Here's the output on Slackware:
Code:
# useradd joseph.blogs |
Quote:
|
Quote:
Code:
static int good_name (const char *name) |
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 Code:
#chown firstname.surname:somegroup somefile |
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 Code:
# useradd TEMPLATEUSER Code:
# cat /etc/passwd | sed -e "s/TEMPLATEUSER/FNAME.LNAME/g" > /etc/passwd Code:
# cat /etc/group | sed -e "s/TEMPLATEUSER/FNAME.LNAME/g" > /etc/group Code:
# cat /etc/shadow | sed -e "s/TEMPLATEUSER/FNAME.LNAME/g" > /etc/shadow Code:
# chown -R FNAME.LNAME:FNAME.LNAME /home/FNAME.LNAME |
All times are GMT -5. The time now is 06:36 PM. |