LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-09-2009, 12:59 PM   #1
ceci2
Member
 
Registered: Dec 2004
Posts: 40

Rep: Reputation: 15
Question how to rename a username?


Hi.

I accidently created an account with the wrong username. I need to change it to something else.

I never done this before but I think you can issue this command "usermod -l login-name old-name" which only changes the username nothing else.

I know I will also need to change the home directory to reflect the changes but I am not sure what to do.

THank you

Ceci
 
Old 11-09-2009, 01:13 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
The man page for usermod says:
Quote:
-l, --login NEW_LOGIN
The name of the user will be changed from LOGIN to NEW_LOGIN.
Nothing else is changed. In particular, the user's home directory
name should probably be changed manually to reflect the new login
name.
So, after running that command simply re-name the directory in /home:

Code:
su      ## to become root
cd /home
mv oldname newname
 
Old 11-09-2009, 02:25 PM   #3
ceci2
Member
 
Registered: Dec 2004
Posts: 40

Original Poster
Rep: Reputation: 15
that works, thank you!

I suppose deleting an account is the same process

"/usr/sbin/userdel -r baduser"

which removes everything. Correct?

Thank you so much.

Cec
 
Old 11-09-2009, 02:32 PM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
correct...
 
Old 11-09-2009, 02:43 PM   #5
ceci2
Member
 
Registered: Dec 2004
Posts: 40

Original Poster
Rep: Reputation: 15
thank you!
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I match username from username/ ? abefroman Linux - Newbie 2 04-26-2009 09:10 PM
fedora 8 asking username but during installation i dint give any username ?? herevenku Linux - Newbie 2 08-25-2008 04:37 AM
Differance between su <username> and su <username> - guguma Linux - General 3 08-19-2007 01:01 PM
useradd: invalid username username$ engyeow Fedora 5 12-05-2004 04:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 08:00 PM.

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
Open Source Consulting | Domain Registration