I have changed my username and when I did this,I can not log in with my new user and this error comes in the screen: nautilus could not create the following required folders: /home/"last username"/desktop and /home/'last username'/.nautilus .Also when I press CTRL+ALT+F6 for the command line I can not login with my new username. Although I have still access to Linux by root. My Ubuntu version is 11.04 .
2 Answers
You're going to want to log in as root to do this
Firstly, make sure the home folder of your old username does not exist.
ls /home
If you see a folder with your old username, issue the command
mv /home/[oldusername] /home/[newusername]
Then issue the command
usermod -d /home/[newusername] [newusername]
usermod -d /home/[newusername] [oldusername] (just for good measure)
If you still can't log in after this, you'll have to edit the /etc/passwd file
nano /etc/passwd
- Find the line that starts with either your old or new username
- Make sure the first field is your new username
- Make sure the 6th field (after the 5th colon) is your new home directory - /home/[newusername]
- Take note of the UID and GID fields (the second and third respectively), this is usually 1000 on single-user systems. If it's not, write it down or remember it. I denote these fields as [UID] and [GID] below.
chown -R [UID]:[GID] /home/[newusername]
I had this problem on RHEL6. It was because I had a gui enabled and I was trying to log in with my domain Id's. I could not get logged in.
Then I did this step
Once the machine is on the domain open the console (not SSH) and log in as root. Click on System>Administration>Authenication. Change the User Account Database to Winbind. (If you do not do this you will not be able to log in.
At this point I was able to get logged in, but this is where I started receiving the Nautilus errors.
I then went back to System>Administration>Authenication. ** Click on Advanced Options and click the Check box beside Create home directoires on the first logon.
This fixed the problem for me and my home drives were created.
Hopes this helps someone.