Linux system misoperation Execution: Chmod-r 777/After repair method __linux

Source: Internet
Author: User
Tags chmod ssh file permissions

Careless mistake operation: Chmod-r 777 ... Finished. All file permissions on the Linux system have been modified for informational purposes only.

Linux system does not operate: Chmod-r 777 Repair Method:

1 do not exit the current login window when you are done.

SSH login is not on, should with passwd, group, shadow, ssh these several files to relate just, opened 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

Service sshd Restart Restart sshd Services

Test reconnect SSH To see if the connection succeeds until the connection succeeds

2)

Find a Linux system (as clean as possible), export the system's permissions, and then import it into the local computer.
Execute on a good machine

CD/
Getfacl-r/> Linux.chmod.txt
and upload it to the machine that you want to fix via the FTP or RZ command.
Perform:

CD/
Setfacl--restore=linux.chmod.txt

Direct view: Permissions are normal. Do it again and check again for normal.
If not in/directory execution, the result does not take effect, estimated need reboot bar. All recommendations for export and import operations under root/directory


If this is not normal, you can try the following before Reboot,reboot again:

Mkdir-p/root/sh

cd/root/sh/
VI 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 '

chmod 755 ' which passwd '

chmod u+s ' which passwd '

Service sshd Restart
#-----------------End----------
Put to boot
Echo '/root/sh/sshtmp.sh & ' >>/etc/rc.local
Then reboot it.
If you can log on to the system after reboot, you can kill the sshtmp.sh process first and remove the/etc/rc.local script. Then see if the permissions are normal.


This article references: http://blog.sina.com.cn/s/blog_5937eedc0101h619.html


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.