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?

3 Answers 3

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.

5
  • That seems to be a good idea. However, I cannot use sudo.
    – user203053
    Nov 17, 2013 at 16:43
  • I will try that.
    – user203053
    Nov 17, 2013 at 16:46
  • pam-auth-update can help him for sure
    – Raja G
    Nov 17, 2013 at 16:49
  • I have reinstalled libpam-runtime, but it did not help. Then when I rebooted, as I suspected, I could not log in any more. Now I am using the LiveCD. I will try to copy the /etc/pam.conf from there.
    – user203053
    Nov 18, 2013 at 11:16
  • 1
    @user203053 remember /etc/security/pam_env.conf
    – Braiam
    Nov 18, 2013 at 11:47
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..

2
  • he said he can not use sudo
    – Raja G
    Nov 17, 2013 at 16:45
  • Thanks Sushantp606. But I got the problem: Error executing command as another user: Not authorized. I will try again in recovery mode.
    – user203053
    Nov 17, 2013 at 17:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .