LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-13-2014, 04:17 AM   #1
Anil Kagi
Member
 
Registered: Aug 2014
Distribution: LinuxMint 17 Qiana Cinnamon
Posts: 149

Rep: Reputation: 0
Unable to Login after editing the etc/passwd file LM17


Hi there,

I am back with my problems again. Kindly help me.

My system specifications: Samsung RV509, i3, 300GB HDD, 3GB Ram, Dual boot Windows7 & LM 17 cinnamon qiana.

I am the Root.

What I did?
I manually edited the 'etc/passwd' file to change three UIDs from 1000, 1001 & 1002 to 999, 998 & 997.

Why I did it?
When I or any other users tried to login, I wanted that the Login prompt should appear instead of the user list appearing by default.

What was the result?
After editing the etc/passwd file I opted for a 'New Login' and accordng to my wishes the user list did not appear and I got the Login prompt. I was delighted. However to my misfortune, when I restarted the system I was not able to Login. The Login promt appeared but when I entered my ID & Password I got an error message. It appeared only once and I didn't bother to save it assuming that I could revert back to the backed up etc/passwd file and could resolve the issue. The error message said something about the 'home/.dmrc' and XSession and mentioned something like 'the user should have 644 permissions and others should not be able to authorised'.

When I couldn't login, I restarted the system with the LiveUSB and copied back the backed-up 'etc/passwd' file and tried to login again but I started recieving an error message persistently. [which I have enclosed herewith].

Enclosure: Kindly forgive the quality of the image of the error report. I had to take several snaps of the long report, with my mobile phone and join them by cutting & pasting. Thank you.

Error message-

Click image for larger version

Name:	LinuxMint Login Error Report.jpg
Views:	24
Size:	149.4 KB
ID:	17101

How I tried to resolve?
I Logged in with my Live-USB. Mounted the 'Root-partition' with the help of the DISKS application and opened the file system as Root. Replaced with the backed up file once and Re-edited twice the etc/passwd file, saved and exited. But when I restarted the system the problem was persistant.

Please kindly help me resolve this issue. I would be greatful to you.

Thank you & Regards

Anil
 
Old 12-13-2014, 04:30 AM   #2
EDDY1
LQ Addict
 
Registered: Mar 2010
Location: Oakland,Ca
Distribution: wins7, Debian wheezy
Posts: 6,838

Rep: Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649Reputation: 649
Try
Quote:
adduser <whoever>
& accept the defaults
 
Old 12-13-2014, 06:17 AM   #3
Anil Kagi
Member
 
Registered: Aug 2014
Distribution: LinuxMint 17 Qiana Cinnamon
Posts: 149

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by EDDY1 View Post
Try & accept the defaults
Hello EDDY1,

Thanks for coming.

I logged in with LiveUSB. Opened the terminal. Typed 'sudo adduser user1', hit enter, I was asked to enter new password. I entered. Then accepted the defaults. Did the same for 'sudo adduser user2' & 'sudo adduser user3'. Then restarted the system. I got the Login screen and was prompted for login name & password. I entered. I got the below error message; [I had got this error earlier too. The one that I had ignored to save then.]

Click image for larger version

Name:	20141213-0001a.jpg
Views:	19
Size:	238.9 KB
ID:	17105

I restarted again. This time I got the same error report that I have attached in my last post.

Thank you EDDY1 for your effort.

Regards

Anil

Last edited by Anil Kagi; 12-13-2014 at 06:59 AM.
 
Old 12-13-2014, 08:59 AM   #4
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Rep: Reputation: 43
Can you boot in recovery mode ? (See: http://askubuntu.com/questions/15036...-recovery-mode)
Only after that, you could try:
Code:
adduser <whoever>
 
Old 12-13-2014, 09:55 AM   #5
Anil Kagi
Member
 
Registered: Aug 2014
Distribution: LinuxMint 17 Qiana Cinnamon
Posts: 149

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by manu-tm View Post
Can you boot in recovery mode ? (See: http://askubuntu.com/questions/15036...-recovery-mode)
Only after that, you could try:
Code:
adduser <whoever>
Thank you manu-tm for the suggestions and the link,

I did as suggested.

When in the recovery mode I gave the 'adduser' command for the User1, user2 and the user3 it returned as 'the user already exists' for all the three users. Then I exited and restarted. However the problem persisted. I got the same error message as posted in #1.

Thanks for your efforts

Regards

Anil
 
Old 12-13-2014, 10:19 AM   #6
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Rep: Reputation: 43
BTW, why didn't you reset the 3 UIDs to their previous values in /etc/passwd? It should fix your login problem.

Last edited by manu-tm; 12-13-2014 at 10:54 AM.
 
Old 12-13-2014, 10:29 AM   #7
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Rep: Reputation: 43
Also
Quote:
Originally Posted by Anil Kagi View Post
Why I did it?
When I or any other users tried to login, I wanted that the Login prompt should appear instead of the user list appearing by default.
I'm not sure what you want to do. You want to be able to type the user name first?

Anyways, manually changing UIDs in /etc/passwd is likely to break something. Maybe you could have a look at the adduser man page and check out home dir options (and other ones as well).

Last edited by manu-tm; 12-13-2014 at 10:58 AM.
 
Old 12-13-2014, 11:44 AM   #8
Anil Kagi
Member
 
Registered: Aug 2014
Distribution: LinuxMint 17 Qiana Cinnamon
Posts: 149

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by manu-tm View Post

BTW, why didn't you reset the 3 UIDs to their previous values in /etc/passwd? It should fix your login problem.
I did that manu-tm. But it didn't solve the problem. I get the error message, that I posted in my first post.

Quote:
Originally Posted by manu-tm View Post

Also I'm not sure what you want to do. You want to be able to type the user name first?
Yes, I want to be able to type the user name first instead of the Login screen displaying the list of users.

Quote:
Originally Posted by manu-tm View Post

Anyways, manually changing UIDs in /etc/passwd is likely to break something.
As I said earlier, I did that with no result. I get the error message.

Quote:
Originally Posted by manu-tm View Post

Maybe you could have a look at the adduser man page and check out home dir options (and other ones as well).
I am sorry. Since I am new to Linux, I didn't get your point. Where is the adduser man page? How would I get to it? What measures should I take there?

Thank you for being with me, manu-tm. I appreciate your compassion.

Regards

Anil
 
Old 12-13-2014, 11:57 AM   #9
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Rep: Reputation: 43
Just type in a terminal:
Code:
man adduser
man page = manual page. If <command> has a man page, you can read it with:
Code:
man <command>
 
Old 12-13-2014, 12:40 PM   #10
Teufel
Member
 
Registered: Apr 2012
Distribution: Gentoo
Posts: 510

Rep: Reputation: 120Reputation: 120
Quote:
Originally Posted by Anil Kagi View Post
When in the recovery mode I gave the 'adduser' command for the User1, user2 and the user3 it returned as 'the user already exists' for all the three users.
You can't create users with existing names.
As root:
Create new users with unique name and set unique password.
Code:
useradd -m -G users -s /bin/bash <newusername>
passwd <newusername>
Copy all the files & directories from old user's home to new one and change ownership:
Code:
cp -R /home/<oldusername> /home/<newusername> && chown -R <newusername>.users /home/<newusername>
That's all.

Try to login as new user and test it. If all seems good, do the same for other users.
Once you system became usable, you can remove old users and their home directories.

Last edited by Teufel; 12-13-2014 at 12:43 PM.
 
Old 12-13-2014, 04:27 PM   #11
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Jessie, Linux Mint 17
Posts: 7,750

Rep: Reputation: 271Reputation: 271Reputation: 271
Your problem is a mismatch between your new user numbers and the user number kept in each file and directory to show the ownership of the file or directory. You changed 'etc/passwd' file to change three UIDs to 999, 998 & 997. However you left all of the files and directories owned by those users as being owned by users 1000, 1001 & 1002. So the new UIDs cannot access the files still owned by the old UIDs.

You could fix the problem by logging in as root and using the chown command to make the file and directory ownerships correspond to the new UIDs.

----------------------
Steve Stites
 
Old 12-13-2014, 06:06 PM   #12
sounds greek 2 me
LQ Newbie
 
Registered: Dec 2014
Posts: 6

Rep: Reputation: Disabled
Quote:
Originally Posted by Anil Kagi View Post
I am the Root.

What I did?
I manually edited the 'etc/passwd' file to change three UIDs from 1000, 1001 & 1002 to 999, 998 & 997.
You have to be careful when manually editing files as it can effect other settings/files in the system. The proper way is to use the usermod command to change the users ID's. This would have also updated any settings/files in the system to reference the change.
Code:
usermod -u 999 curly
usermod -u 998 larry
usermod -u 997 moe
If curly, larry, and moe ID's were 1000, 1001, 1002 respectively, the above codes would change the old ID's in the /etc/passwd file to the new ID's of 999, 998 and 997.

I'm not sure it's going to work now because the damage has been done. But you can use the code in the future to properly change the user's ID.

Last edited by sounds greek 2 me; 12-13-2014 at 06:16 PM.
 
Old 12-14-2014, 12:28 AM   #13
Anil Kagi
Member
 
Registered: Aug 2014
Distribution: LinuxMint 17 Qiana Cinnamon
Posts: 149

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by Teufel View Post
You can't create users with existing names.
As root:
Create new users with unique name and set unique password.
Code:
useradd -m -G users -s /bin/bash <newusername>
passwd <newusername>
Copy all the files & directories from old user's home to new one and change ownership:
Code:
cp -R /home/<oldusername> /home/<newusername> && chown -R <newusername>.users /home/<newusername>
That's all.

Try to login as new user and test it. If all seems good, do the same for other users.
Once you system became usable, you can remove old users and their home directories.
Hello Teufel,

Thank you for coming.
I tried as suggested in recovery mode. But when I restarted, even before the Login screen is loaded a message was displayed that said 'Keys: Press S to skip mounting or M for manual recovery'. I pressed S. Nothing happened. I pressed M. The command prompt appeared. I repeated again the steps you suggested and created another new user and exited and restarted. But again the message appeared saying 'Keys: Press S to skip mounting or M for manual recovery'. This time I pressed only M and created another user and exited and restarted. But again the same message appeared.

Thank you for efforts Teufel

Regards

Anil
 
Old 12-14-2014, 12:35 AM   #14
Anil Kagi
Member
 
Registered: Aug 2014
Distribution: LinuxMint 17 Qiana Cinnamon
Posts: 149

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jailbait View Post
Your problem is a mismatch between your new user numbers and the user number kept in each file and directory to show the ownership of the file or directory. You changed 'etc/passwd' file to change three UIDs to 999, 998 & 997. However you left all of the files and directories owned by those users as being owned by users 1000, 1001 & 1002. So the new UIDs cannot access the files still owned by the old UIDs.
----------------------
Steve Stites

Thank you jailbait for coming,

Nice diagnostic explaination. That explains it all. Yes this is what might have happend in my case.

Quote:
Originally Posted by jailbait View Post

You could fix the problem by logging in as root and using the chown command to make the file and directory ownerships correspond to the new UIDs.

----------------------
Steve Stites
Forgive my ignorance. Could you please give me a step by step guidance as to how to do this?

Thank you for your compassion.

Regards

Anil
 
Old 12-14-2014, 12:45 AM   #15
Anil Kagi
Member
 
Registered: Aug 2014
Distribution: LinuxMint 17 Qiana Cinnamon
Posts: 149

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by sounds greek 2 me View Post
You have to be careful when manually editing files as it can effect other settings/files in the system. The proper way is to use the usermod command to change the users ID's. This would have also updated any settings/files in the system to reference the change.
Code:
usermod -u 999 curly
usermod -u 998 larry
usermod -u 997 moe
If curly, larry, and moe ID's were 1000, 1001, 1002 respectively, the above codes would change the old ID's in the /etc/passwd file to the new ID's of 999, 998 and 997.

I'm not sure it's going to work now because the damage has been done. But you can use the code in the future to properly change the user's ID.
Thank you sounds greek 2 me, for coming.

I tried the 'usermod' as suggested in the recovery mode. But as you said the damage has been done. It didn't work.

Yes, really I shouldn't have done manual editing with my kind of ignorance of the OS. I took suggestions from the web and tried somethings earlier. Since they didn't work, I tried this reckless thing.

Thank you for the information and caution sounds greek 2 me.

Regards

Anil
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to login using root after changing root password using passwd command rodimail SUSE / openSUSE 3 12-27-2011 11:34 PM
[SOLVED] Modified "/etc/passwd", unable to login as root! tulsi Linux - General 8 12-28-2009 11:53 AM
Which accounts listed in the /etc/passwd file should have a login shell ? uncle-c Linux - Security 4 10-19-2009 07:31 PM
Editing of any file in /etc directory will disturb our root login? Karthi_India Linux - Newbie 2 07-14-2007 11:24 PM
Remote login and editing the file jayesha18 Linux - Networking 0 03-04-2006 07:21 AM


All times are GMT -5. The time now is 10:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration