LinuxQuestions.org
Review your favorite Linux distribution.
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 12-22-2004, 11:57 PM   #1
rahul_kulkarni
Member
 
Registered: Dec 2004
Posts: 32

Rep: Reputation: 15
Change the username


Hello All,

Is it possible to change the usernames on Linux? I have a Linux box with 10 users (username = firstname). As the number of users are growing I want to change the username convention to include the last names also (username = firstname_lastname). So is it possible to change the existing usernames without changing their profile?

Thanks in advance,
// Rahul
 
Old 12-23-2004, 12:24 AM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,093

Rep: Reputation: 300Reputation: 300Reputation: 300Reputation: 300
Yes, usermod -l should do what you want. besure to change home directory's to be in sync with the new user name.
 
Old 12-23-2004, 02:09 AM   #3
rhoekstra
Member
 
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 348

Rep: Reputation: 39
A few pitfalls:

Some distros create a group with the same name as the user, so user john gets the group john.

'usermod -l john_smith john' will change the username from john to john_smith, but not his group. he will be john_smith in group john.
use 'groupmod -n john_smith john' to change the groupname accordingly to get the group changed. Again, IF your distro does such.

indeed, the home directory...
using 'usermod -l john_smith john' does change the username, but not his home directory!..
use 'usermod -l john_smith -d /home/john_smith john' instead, to make the homedir change as well..
Don't forget to rename his homedirectory with 'mv /home/john /home/john_smith'.

Finally: the mail spool file.. I don't know if distros fix that automagically. User john has his own mail spool file, in most cases '/var/spool/mail/john'. You'll have to rename the file to fit the new username with 'mv /var/spool/mail/john /var/spool/mail/john_smith'.

<disclaimer>
Oh, I based the given commands on my distro, Fedora. I can't tell how your version would react. Mostly they're alike, just to be sure: 'man usermod', 'man groupmod' to verify correctness.
</disclaimer>
This would fix a lot.

PS using samba? don't forget to change the user over there as well.

Last edited by rhoekstra; 12-23-2004 at 02:13 AM.
 
Old 12-23-2004, 11:18 AM   #4
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 52
..or, just " #mv /home/john /home/john_smith
and then " #adduser < add the user j_s > ; you'll be prompted to change ownership of the dir.

and as said, check the group-file.

egag
 
  


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
Can I change my username? ssobeht LQ Suggestions & Feedback 19 10-14-2005 09:03 AM
username change...... roshu Linux - Software 2 03-10-2005 03:31 AM
Change username? theonebeyond LQ Suggestions & Feedback 3 12-05-2004 12:32 PM
change username thelight1 LQ Suggestions & Feedback 2 05-19-2004 10:24 PM
username change nakkaya Linux - General 3 02-28-2003 02:10 PM


All times are GMT -5. The time now is 07:29 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration