1

I deleted all common-* files in /etc/pam.d folder and now I am locked out. I am running Ubuntu 14.04. I did backup all these files in a folder inside pam.d but now I can't even move them. If I try, I get a permission error. If I add sudo, I get this error:

sudo: unable to initialize PAM: No such file or directory

Here are things I tried and failed:

  • sudo pam-auth-update --force (get above error)
  • Went into recovery mode and ran "Repair broken packages"
  • Went to recovery mode, and chose 'root - Drop to root shell prompt'. When I hit enter, I get this:

    Give root password for maintenance. (or type Control-D to continue)** 
    

I never set any password for the root account and I believe it might be disabled. I get access to the console via the web and do not have access physically.

I did tons of searching on Google and almost all point to using LiveCD which is not an option for me. Is there anything else I can do to fix it?

  • Whomever the admin is will have to either boot from a LiveCD/LiveUSB or reinstall. If you don't have root or physical access to the machine then there's nothing that you can do. – Nasir Riley Sep 4 '18 at 21:27
  • 1
    Ok, thanks. Now I can rebuild in peace knowing there are no other options. I will add pam.d to my do not delete list :) – Damon Sep 4 '18 at 23:20
-1

If your web console has access to edit Grub, you can change the init= portion of the boot string to: init=/bin/bash

That will drop you directly into a bash shell.

From there you'll need to remount the system from read-only to read-write.

mount -o remount,rw /

Once the system is read-write, you can restore your files.

Also while there, if you wish, you can set the root password.

  • If he doesn't have root access then it's highly unlikely that he can edit grub. – Nasir Riley Sep 8 '18 at 0:28
  • He can't edit the grub configuration on the filesystem - but he may be able to edit the grub entry on boot. – foobar Sep 9 '18 at 3:08
  • How can he edit it on boot when he doesn't have root or physical access? – Nasir Riley Sep 9 '18 at 6:34
  • @Nasir Riley: You don't need root to edit the grub entry on boot (although a username/password combination can be set separately for it). The root account on the linux system is completely irrelevant to grub's boot operations. Additionally, web consoles typically do show the boot-loader - this is confirmed since the user says the can get into "Recovery Mode" which is typically an option selected in the boot-loader. – foobar Sep 10 '18 at 15:02
  • He would have to drop into a shell to edit grub. He has already stated that he is prompted for a root password when he tries to do that. Your suggestion doesn't work. – Nasir Riley Sep 10 '18 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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