Linux system misuse directory permissions chmod 777 - Recovery Methods

White operate Linux, tremor cause false modify the system file and directory permissions, resulting in repair system downtime.

chmod 777 -R / 
chmod 777 -R / test

Some really do not understand, the first implementation of the above command, some to understand, but too fast or careless operation, or have bad habits Luanqiao spaces, and so on ... the list goes on, in short, we were in trouble.

Linux, if you accidentally misuse the root of the directory permissions batch settings, such as chmod -R 777 /, the system most of the service and the command will not be able to use this time to copy and can restore the system privileges through the system comes with command getfacl , if the other system directories from being mishandled, is also possible.

Repair method is as follows:

# 1 , (preferably the same kernel version and the server failure) through the normal rights of a Linux command: 
the getfacl -R /> systemp.bak 

# this normal system / permissions for all the backup files are stored in the directory systemp. bak in. 

# 2 , if the server is not restarted abnormal operation and the like is not connected to the end, may be used scp command transmitted abnormal normal backup file server, the command is:
 scp the root @ target machine IP: system.bak file path of the local storage system.bak path 

# other methods may also be moved to the exception systemp.bak server. 

# 3 , execute commands on the server anomaly: 
the setfacl --restore = systemp.bak 

# can now be restored to the normal system of system privileges and the same. 

4 , reboot reboot the system 
# If you perform the above procedure, still can not pass the ssh remote server, then look at the system log message

 

For example, given: Client:
[c: \ ~] $ SSH 10.68.215.215 29992

Connecting to 10.68.215.215:29992...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Connection closed by foreign host.

Disconnected from remote host(10.68.215.215:29992) at 13:10:18.

Type `help' to learn how to use Xshell prompt.


重启sshd服务报错
root@bt:~# /etc/init.d/ssh start
* Starting OpenBSD Secure Shell server sshd
Could not load host key: /etc/ssh/ssh_host_rsa_key
Could not load host key: /etc/ssh/ssh_host_dsa_key


Message being given service (message log and restart the ssh service are prompt)
/ etc / ssh / ssh_host_dsa_key
etc / ssh / ssh_host_rsa_key
file permission issues, please refer to the normal system file permissions, the above command directory file permissions adjustments and normal system the same rights to:

# CentOS7.x

 

# CentOS6.x

 

Guess you like

Origin www.cnblogs.com/miaocbin/p/11427676.html