LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 08-26-2005, 03:19 PM   #1
Nuvious
Member
 
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
saman007uk
Member
 
Registered: Dec 2003
Location: ~root
Distribution: Debian
Posts: 364

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
bosewicht
Senior Member
 
Registered: Aug 2003
Location: Houston, TX
Distribution: Arch
Posts: 1,381

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
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
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!
 
  


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 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:21 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
Open Source Consulting | Domain Registration