I have accidently removed the files /etc/pam.conf
and /etc/security/pam_env.conf
using 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?
I just copied the files '/etc/pam.conf' and '/etc/security/pam_env.conf' and the folder 'pam.d' from the Ubuntu Installation Disk.
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.
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..