how to change the main user name on xubuntu 8.04?

Asked by Terry O'Brien

Hi, I have Xubuntu 8.04 and need to change original user details to give the PC to a friend. From Lars Friedrichs advice above I completed the first part but when I typed in: sudo cp /etc/passwd /etc/passwd.backup - the word 'password' appeared with the cursor flashing - but when I went to type in the password - the cursor didn't respond! Is there a graphical way to achieve the same outcome? I would have thought an easy changeover of ownership would mean a simple straightforward change of user details. Can anyone shed more light please? Thanks - 999terry

Question information

Language:
English Edit question
Status:
Answered
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Tom (tom6) said :
#1

Hi :)

When the sudo command requests your password it doesn't show any stars as you type but it does accept the input you type. Try again but this time just type in the password and press <enter>. The lack of stars is a security feature to prevent people/bots from capturing even the length of your password.

Please could you give us a link to the instructions you are following? Then people trying this in the future might find this thread more useful.

I hope this helps!
Thanks, good luck and regards from
Tom :)

Revision history for this message
Sam_ (and-sam) said :
#2
Revision history for this message
Terry O'Brien (dialogue-quest) said :
#3

thanks Tom, and so now when I get to the point where it allows me to move on:
after typing in - sudo cp /etc/passwd /etc/passwd.backup I get the following message - cp: cannot create regular file `etc/passwd.backup': No such file or directory.
So what do I do now?

Revision history for this message
Terry O'Brien (dialogue-quest) said :
#4

Also - sorry I forgot to note the Question link but here it is as copied:

Hi,
Question 2 is pretty easy, open system->administration->network, select the second tab and change the computer's name.
Question 1 is quite unusual because it is very uncommon to change the user's name and even more unusual to change the home directory. Since programs may store the full path to certain files these programs don't work any longer if you change the home directory. What you can do is the following: (be careful, manual editing of system files requires caution, always a backup and a recovery cd in reach)
Let's pretend your old username is "old", the new one should be "new".

open a terminal window
type

sudo cp /etc/passwd /etc/passwd.backup
   (we do a backup first)
sudo gedit /etc/passwd

look for a line starting with "old:..."
change every "old" to "new" in that line - should be in two places: the username left and the home directory on the right.
save the file.

sudo mv /home/old /home/new
   (now the directory has the new name)
sudo ln -s /home/new /home/old
   (we do this so programs may look at the old name or at the new name by creating a symbolic link that points to the new directory and is named like the old dir.)

Normally the last step should not be needed but we try to play safe here.

Bye
Lars
Best Lars Friedrichs said on 2007-06-25:

Of course, don't forget to log out and in again...
Eglaelin said on 2007-06-25:

Thanks Lars Friedrichs, that solved my question.
for the following information but here it is copied:

Revision history for this message
Tom (tom6) said :
#5

Hi :)

I think the instructions you are following are for a much more tricky scenario than the one you are in.

In the guide they want the existing user to have all their stuff, all their bookmarks and data and settings and everything to all be available to the new user. They also want the new user to have all the same rights and priveleges that thte old user had.

In your case you want to create a new user with all the rights and priveleges but none of the data. That should make the task significantly easier. I think you have also run into the additional problem of having run out of space on your hard-drive!

You haven't yet started on the MoVing data part of this guide have you? If not then i would be tempted to delete the new user and start again. Then empty your wastebin. To start again i would go up to the top taskbar and click on

System - Administration - Users&Groups

click on the "Unlock" button and enter your normal user password. Then click on the "+ Add User" button to create the new user account. In the form keep things very basic and quite empty. You only need to give a username and user-password, none of the ret needs to be filled in so leave it blank. Change the "Profile" to "Administrator". The "Contact" tab should be completely empty. Check the last 2 tabs; User Priveleges and Advanced have at least all the same ticks as your current user, more is good.

Now hopefully you should be able to "Switch Users" (from the off-button on the top taskbar) and login to the new account. Try using Synaptic Package manager to install a simple game or something, such as "Neverball". Did that work? Either way please let us know.

Also if please feel free to ask us to break this down into smaller stages or anything
Good luck and regards from
Tom :)

Revision history for this message
Terry O'Brien (dialogue-quest) said :
#6

Hi Tom, I did as you suggested but after deleting and reinstalling the username I wish to use, it came up "username already in use". I really do wish to only have one username in the whole system, not two; and I want the old username which has established itself as the desktop/home folder name to be replaced with the new name. In effect I want the system to completely identify with the one username the way it sets itself up upon installation. So how do I achieve this? Do I do something like Lars has suggested above, or is there another or more simple way?
Thanks - Terry

Revision history for this message
Tom (tom6) said :
#7

Hi

I think a 2 step process

1. Set up a new 2nd username and make it fully functional.
2. Delete off the old username and all the files that are in it.

Lars is saying

1. setup new username, make it fully functional
2. Copy everything all the files and everything from the old username into the new one
3. Change various configurations and other things around to make the file's in the new one accept the new name
4. Delete off the old username

Unfortunately steps 1-3 are intertwined and it's a bit unclear exactly which order things are being done in and you are stuck right in the middle of all that.

I think what you want is an empty blank username with none of your files in it, just the normal setting such as you would get from a fresh install but perhaps benefiting from all the hard work you have put in to make this work on this machine. I think it's a shame because you seem to be right there and could keep the machine yourself having built up a lot of knowledge about how it all works. You're nearly at the plain-sailing stage where everything is suddenly easy.

Regards from
Tom :)

Revision history for this message
Tom (tom6) said :
#8

Hi again

From where you are now (which isn't an ideal starting point) perhaps the best option might be to

1. make a 3rd username and make it fully functional
2. delete off the 2 old ones

Is this possible or are you really stuck on having the new username that you had already chosen? The problem with trying to do anything with that is that we do not currently know what the state the username's permissions are in and where all the files are. Trying to find out those 2 uncertainty's is likely to drive us crazy with neither of us being entirely sure what the other is saying, what they mean and what they are seeing. So it would be much better to just start again.

Regards from
Tom :)

Revision history for this message
Sam_ (and-sam) said :
#9

Terry,
I guess you need to understand the identification isn't related to a name, it's related to UserID (UID).
e.g. the first user Alice has UID 1000, Bob has 1001 and so on.
The name changing has nothing to do with UIDs. The system doesn't care about names, it cares about IDs.
Names are just conventional for the user.

The initial group usually contents the real_name and user_name (login_name), usually in Ubuntu they're the same.
Lets say the UID is 1000 and username is Alice
grep 1000 /etc/passwd
or
grep Alice /etc/passwd

##output e.g.
Alice:x:1000:1000:another_name_of_Alice,,,:/home/Alice:/bin/bash

please see also manpages:
man id
id --help
man usermod
usermod --help
man groupmod

Simple option e.g.:
Boot in Recovery Mode
Swich to root shell
usermod -d /home/new_name -m old_name
usermod -l new_name old_name
groupmod -n new_name

##Check if UID, GID are set correctly with:
id
##then
reboot

In case the username of /home didn't change try this:
usermod -d /home/new_name -m new_name

Another example:
http://ubuntuforums.org/showthread.php?t=821685&highlight=change+user+name&page=2

Can you help with this problem?

Provide an answer of your own, or ask Terry O'Brien for more information if necessary.

To post a message you must log in.