Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 08-26-2005, 03:19 PM   #1
Registered: Mar 2005
Posts: 34

Rep: Reputation: 16
Question Renaming a user?

Any easy way to rename a linux user in the console?
Old 08-26-2005, 03:24 PM   #2
Registered: Dec 2003
Location: ~root
Distribution: Debian
Posts: 363

Rep: Reputation: 33
edit the /etc/passwd, /wtc/group and /etc/shadown group. After that, change the owner of the homedirectory to the new user.
Old 08-26-2005, 03:31 PM   #3
Senior Member
Registered: Aug 2003
Location: Houston, TX
Distribution: Arch
Posts: 1,380

Rep: Reputation: 47
why not just create a new user then change permissions on the home dir? it's easier than editing the files

# useradd -m -s /bin/bash newuser
# passwd newuser

mv -fr /home/olduser /home/newuser
chown -R newuser /home/newuser
Old 08-27-2005, 12:58 AM   #4
LQ 5k Club
Registered: May 2003
Location: London, UK
Distribution: Debian "Testing"
Posts: 6,088

Rep: Reputation: 407Reputation: 407Reputation: 407Reputation: 407Reputation: 407
saman007uk and bosewicht,

Unfortunately, this doesn't work, although, intuitively, it feels as though it should.

The problem is that many of the configuration files (~/dotSomething) contain references to olduser. They do not work when simply chown'd. For example, see the output of grep -r /home/olduser/.*

I suppose you could write some sort of script with sed to change all the references to olduser to newuser within these files, but then there are also some files in /tmp which have the same problem, but this time the change needs to be made to the filename, and in my experience this all turns into a major nightmare!

The only solution I have managed to get to work is to create a new user, set up all those preferences, then copy over data files (eg docs, mp3's), and then chown them. A real pain!


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
Help with renaming machine MbowerARA Linux - General 5 07-29-2005 05:23 PM
Renaming this forum? Sslaxx SUSE / openSUSE 11 11-09-2004 11:39 PM
Renaming ~/GNUstep Draknek Linux - Software 3 09-12-2004 05:56 AM
Renaming folder jeffpoulsen Linux - General 2 10-21-2002 01:54 PM
Renaming a partition? tomplate Linux - General 7 02-28-2002 01:53 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:34 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration