Ubuntu Play:deletion of /etc/shadow or /etc/password corrupted my env.
by Vivek Mishra
Never mess with /etc/shadow.😦
By mistake I have deleted it and restoring everything takes ages.
I landed myself into series of troubles.
1) Login was not possible.
2) After that my sudo stopped working.
3) Then MySql server stopped working.
1) Login was not possible: Well to address this you need to restore shadow and password file(simpally make a replica of shadow- and password-)
2) Sudo: This was a big problem. After too much googling finally I made it working by following commands.
chown -R root:root /etc/sudoers
chown -R root:root /etc/sudoers.d
chmod u=rwx,g=rx,o=rx /etc/sudoers.d/
chmod u=r,g=r,o= /etc/sudoers.d/*
You might need to run these by login as root.
3) MySql server was not starting up: Upon issuing mySql start:
a) World-writable config file ‘/etc/mysql/my.cnf’ is ignored
b) Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
Reason for this problem is again related to permissions, issuing given below commands resolved my problem:
chmod 770 my.cnf
chmod 770 mysqld_safe_syslog.cnf