Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I recently got a new comp and gave my not so old one to my hubby. It is obviously all in my name, so I am wondering how to change the name of my computer and root and everything from my name and username and password to his.

He changed the display name and password, but when the screen goes to sleep and asks for the password, it says "my username" on "my computer name" but still unlocks with the hubbys password. Help? I know that I did all the naming during the install, and I don't really wanna have to transfer everything to do a clean install, so I'm hoping there is another way.

share|improve this question

3 Answers 3

First, read my answer (at least the bold parts), and then act. Since you may want to keep your old files. Or not. There is a computer name (hostname., a username, and a password for that user. Different terms. Read on.

To change the computer name:
1. Fire up a terminal.
2. Type: sudo gedit /etc/hostname
3. Edit the file according to your need, and save it. Close the editor, you are done. (It'll change after a reboot.)

To change the username:
1. Open up the dash (top-left), and search for "User accounts".
2. There is a "Locked" text somewhere. Click on it, it'll ask for your password.
3. Create a new Administrator account.
4. Login to the new one, delete the old one.

! IF ! you want to transfer every setting and stuff from user X to user Y:
1. Fire up a terminal.
2. type: sudo apt-get install mc
3. (when the previous one is done) type: sudo mc
4. Now, mc is a two-pane based file commander. You select files with Insert, and copy them with F5. What you have to do, is copy all the stuff, from folder /home/userX to /home/userY.
5. (you can switch the sides with TAB) Simply navigate the left side, to userX (old one), and the right side to userY (new one). When you are done, use the Insert key, to select all the stuff from the old user. Press F5 when you are done. Enter to confirm.
6. It'll start copying. May take some time.
7. Finally, you need to exit mc. To do that, press F10. (Or Esc and then 0.
8. When you are in the Terminal, again. Type: sudo chown -R userY:userY /home/userY
(Of course, userY is the new user, who you just made for the new owner.)

share|improve this answer
    
This is the easiest way I know. There may be a software to do all this. But ... it never hurts to learn some linux "magic". –  Shiki Feb 15 '12 at 15:11

@Shiki's answer is good, but a faster way to accomplish the file transfer would be (in a terminal, assuming your username is daisy and the new admin account you created is hubby):

sudo -s
cp -arvP /home/daisy /home/hubby
chown -R hubby:hubby /home/hubby

which requires no extra tools like mc and will also copy the hidden "dot" folders like .gnome, .cache, etc.

The -arv flags for the cp copy command are respectively archive (preserves permissions, file modification times, etc), recursive (copies all folders and subfolders), and verbose (tell you the name of every file being copied.)

Edit: Add the -P flag to cp to prevent it following symbolic links, which is usually a bad thing. (~/.gvfs is an example - it contains symlinks to external/network drives.)

share|improve this answer
    
Hmm thanks, that will come handy. By the way ... why there is no simple utility for this? Just a simple GTK app. –  Shiki Feb 16 '12 at 4:35
    
Because you can accomplish it with three or four terminal commands. useradd adds new users; cp -arvP to copy the files; and chown to change ownership permissions. –  Li-aung Yip Feb 16 '12 at 6:03

An even better way to do exactly what you want (which is change the username, and nothing more) is to use the appropriately named usermod (modify user) command, something like:

sudo usermod daisy -dm /home/hubby
sudo usermod daisy -l hubby

Google strategy: linux change username to give this article (good stuff in the comments too.)

Addendum: excerpt from man usermod:

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

   -d, --home HOME_DIR
       The user's new login directory.

       If the -m option is given, the contents of the current home
       directory will be moved to the new home directory, which is created
       if it does not already exist.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.