1

I have accidently removed the files /etc/pam.conf and /etc/security/pam_env.confusing rm. Now I get this error message when I try to use sudo:

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

How can I fix that?

Braiam
  • 67,791
  • 32
  • 179
  • 269

3 Answers3

3

I just copied the files '/etc/pam.conf' and '/etc/security/pam_env.conf' and the folder 'pam.d' from the Ubuntu Installation Disk.

1

Reinstall libpam-runtime:

sudo apt-get --reinstall install libpam-runtime libpam-modules

If you can't use sudo, use root shell in the recovery mode. You must use wired connection and type:

apt-get --reinstall install libpam-runtime libpam-modules

You can use the root shell and copy the same file saved somewhere else copied from another system or purge the package and install it.

Braiam
  • 67,791
  • 32
  • 179
  • 269
0

i think you are looking for: extundelete - utility to recover deleted files from ext3/ext4 partition

To find such a package, you can try:

apt-cache search undelete

To use the utility install it with:

sudo apt-get install extundelete

After installation click here and read it carefully

For getting back sudo privileges create a file

pkexec gedit /etc/pam.d/common-session-noninteractive

and then just copy and paste these lines

session        [default=1]                     pam_permit.so
session        requisite                       pam_deny.so
session        required                        pam_permit.so
session        required                        pam_unix.so

Save and exit , hope it works..

Sukupa91
  • 3,037
  • 2
  • 20
  • 33