Do not exit the current window after execution!!!
When you set a station's permissions on your own virtual machine, it should be chmod-r 777./* Results less pressing a point, executed chmod-r 777/* Because the execution time exceeded their expected range hurriedly press CTRL + C, unfortunately late, look under the ETC directory of things, All are 777 states, immediately open another terminal to try to login, has not been logged on!
The original execution of the window can also be manipulated, so look for information to see if there is a solution, if the machine room production machines make such a low-level error, can not be re-installed it. Linux is not so fragile.
SSH login is not, should be with passwd, group, shadow, ssh these files are related, open another Linux view permissions, and on the wrong machine to modify the corresponding permissions:
Cd/etc
chmod 644 passwd Group Shadow
chmod Gshadow
CD SSH
chmod moduli ssh_host_dsa_key Ssh_host_key Ssh_host_rsa_key
chmod 644 Ssh_config ssh_host_dsa_key.pub ssh_host_key.pub ssh_host_rsa_key.pub
chmod 640 Sshd_config
Then try SSH login, OK normal, but there is no way to switch to the root user
Su-
Root "Su:cannot Set groups:"
Because Su must have S permission to pre-read the configuration of root:
chmod u+s ' which Su '
After completion, you can go in the system slowly toss.
Find a Linux system (as clean as possible), export the permissions of the system, and then import it to this machine.
Perform on a good machine
Getfacl-r/>./linux.chmod.bak
Then upload to the machine to be repaired via FTP or RZ command.
Perform:
Setfacl--restore=/root/linux.chmod.bak
Do this after the need to restart the machine to replace the permissions (really troublesome, if the online machine can be randomly restarted, in fact, this time the machine can be normal access, but not guarantee security)
Before executing, write a script to make it execute after booting, in case the replacement of the script has a problem, at least can also login ssh. Yes, the above command is written in a script placed in the rc.local and deferred execution. I put it under the/root/.
Cat sshtmp.sh
#----------Start----------
Sleep 300
Cd/etc
chmod 644 passwd Group Shadow
chmod Gshadow
CD SSH
chmod moduli ssh_host_dsa_key Ssh_host_key Ssh_host_rsa_key
chmod 644 Ssh_config ssh_host_dsa_key.pub ssh_host_key.pub ssh_host_rsa_key.pub
chmod 640 Sshd_config
chmod u+s ' which Su '
#-----------------End----------
Put the boot on.
Echo '/root/sh/sshtmp.sh & ' >>/etc/rc.local
Then reboot it.
After restarting, if you can log into the system normally, you can kill the sshtmp.sh process and remove the/etc/rc.local script. Then check to see if the permissions are normal.
root directory execution Chmod-r 777/remediation method