change login name

NoOp glgxg at sbcglobal.net
Sat Jun 21 00:21:02 UTC 2008


On 06/20/2008 02:02 PM, Smoot Carl-Mitchell wrote:
> On Fri, 2008-06-20 at 10:22 -0400, Jeremy Huntwork wrote:
> 
>> Here's how I did it:
>> 
>> 1. Open up Terminal and type in 'sudo -i'. Type in your password at  
>> the prompt.
>> 2. Type 'passwd' and then a new password for the root user and confirm  
>> it at the prompts.
>> 3. Log out
>> 4. Hit 'Ctrl+Alt+F1' to take you to a TTY terminal
>> 5. Login as root with your new password for root.
>> 6. mv -v /home/{olduser,newuser}
>> 7. sed -i 's/olduser/newuser/g' /etc/{passwd,group,shadow}
>> 8. Exit the login, hit Alt+F7 to go back to X and login as the new  
>> user name but with the same password as before. Of course, if you  
>> wanted to change the password too, you could leave out the shadow part  
>> in number 7 and then as root type 'passwd newuser' before exiting.
> 
> Do not forget to change things which depend on the username, if you are
> using those facilities.
> 
> e.g /var/mail/<username>, /var/spool/cron/<username>.

I found this helpful (including the comments):

http://www.cyberciti.biz/faq/howto-change-rename-user-name-id/

I had to do this just as few days ago while setting up a system. I had
set it up to use don and found out the user uses donny. I left the home
directory as don, but changed the rest to donny. Given that it is a new
install there wasn't much in the way of apps that depended too heavily
on 'don' vs 'donny'.

I did not try:

killall -u old
id old
usermod -l new old
groupmod -n new old
usermod -d /home/new -m new
usermod -c “New Real Name” new
id new

but suppose I still could as I'm still messing around with the system &
don't have to deliver it until sometime next week.






More information about the ubuntu-users mailing list