Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

During the Ubuntu 12.04 LTS installation, I was prompted to enter a user name and password, so that a corresponding account could be created and set up for login. I replaced the one that was provided by default (i.e. '70319', which is the Windows 7 admin id) with a user name/id of my choosing.

Now, when I turn on the computer, and choose to enter the Ubuntu operating system, the login id that is displayed is 70319 - that is, the one provided by Windows 7. However, when I open up a Unix/Terminal shell, the user id that is displayed at the prompt is the one I entered during installation. Otherwise, the installation of Ubuntu was a success! Is there some way of changing the user id that is displayed at the Login screen, so that it is consistent with the one I entered during installation?

If it's any help, I installed Ubuntu using wubi on an ASUS Eee PC 1011PX running Windows 7, and ASUS Express Gate Cloud. Further details regarding the setup/installation can be found at the following link:

Installing Ubuntu on an Eee PC 1011PX

share|improve this question

2 Answers 2

up vote 3 down vote accepted

The easy and safe way

Open Terminal with Ctrl+Alt+T, and type:

sudo chfn username

where username is what shows in front of the @ in the prompt.

Your existing "display name" (shown at the login screen, on the top right of the desktop, etc.) will appear enclosed in brackets [] after Full Name:. Type in whatever you want the new "display name" to be and press enter.

You can leave the remaining fields (Room number, Phone, etc.) blank (just keep pressing enter).

Once done, exit the terminal and logout. You should have a shiny new "display name"!


The direct but risky way

The original version of this answer proposed directly editing /etc/passwd to change the "display name". This is risky if you don't know the format of the passwd file, since a typo could leave you unable to login any more. You have been warned.

The general format is:

username:x:1000:1000:displayname,,,,:/home/username:/bin/bash

Change "displayname" to whatever you want the name displayed on the login screen to be, e.g. "John Doe" or just the same as "username". This name CANNOT contain colons, commas or equal-to signs.

Save and quit your editor, and PLEASE then use pwck to check that the format of /etc/passwd is still valid, using:

sudo pwck | egrep -v "directory.*does not exist"

The response you are looking for is:

pwck: no changes

Otherwise, just logout, and you should see your chosen display name.

share|improve this answer
    
Thanks for that izx! It solved my problem! –  Bill May 13 '12 at 5:10
1  
You should NOT edit /etc/passwd directly. At least check its structure afterwards with pwck! A better way to change the displayname is chfn. You even don't need to use sudo. –  ohno May 13 '12 at 8:54
1  
I upvoted your comment @ohno, and am aware of chfn, but the problem is that Ubuntu by default does NOT allow editing the full name with chfn. (CHFN_RESTRICT = rwh in /etc/login.defs). Messing with login.defs to allow chfn to change the full name is even riskier, IMO. But using pwck to verify is a good idea, I will edit the answer to include that. –  izx May 13 '12 at 9:18
    
You still should not edit /etc/passwd directly:-) "sudo chfn ..." seems to override the settings in /etc/login.defs. –  ohno May 13 '12 at 9:29
    
You're making me do my homework :). sudo chfn username is what finally works; sudo chfn didn't/doesn't. –  izx May 13 '12 at 9:39

The easiest and safest way is to do it from the User Accounts application. You can run it by hitting the Windows/Meta key and entering user accounts, or by clicking on your username (with the other app indicators on the top right) and select User Accounts... from the drop down menu.

Then change it: User Accounts

Before:

bcbc@14:00:19:~$ sudo cat /etc/passwd | grep bcbc
bcbc:x:1000:1000:712345:/home/bcbc:/bin/bash

After:

bcbc@14:00:53:~$ sudo cat /etc/passwd | grep bcbc
bcbc:x:1000:1000:bcbc:/home/bcbc:/bin/bash
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.