SSH连现时出现「WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!」解决办法

上周开始试着使用Linode,第一次新建了一个CentOS 7系统image后不知道在装LAMP时哪步出了问题,所以就重装了一下系统。结果在SSH连接时出现如下错误:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is

会出现这样的错误是因为,第一次进行SSH连接时,电脑会生成一个认证储存在客户端中的known_hosts,但如果服务器重新装过以后,认证信息相应地也会发生变化。服务器和客户端的信息不匹配时,就会提示错误。解决办法就是将know_hosts文件里那个无效的记录删除。

Mac系统用户在终端输入
nano ~/.ssh/known_hosts

Windows系统PuTTY用户要在注册表里找如下信息:

HKEY_CURRENT_USERSoftwareSimonTathamPuTTYSshHostKeys

Advertisements

把网站域名改为子文件夹,不改变URL的方式(.htaccess)


# Change yourdomain.com to be your primary domain.

RewriteCond %{HTTP_HOST} ^(www.)?yourprimarydomain.com$

# Change 'subfolder' to be the folder you will use for your primary domain.

RewriteCond %{REQUEST_URI} !^/subfolder/

# Don't change this line.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Change 'subfolder' to be the folder you will use for your primary domain.

RewriteRule ^(.*)$ /subfolder/$1

# Change yourdomain.com to be your primary domain again.
# Change 'subfolder' to be the folder you will use for your primary domain
# followed by / then the main file for your site, index.php, index.html, etc.

RewriteCond %{HTTP_HOST} ^(www.)?yourmaindomain.com$
RewriteRule ^(/)?$ subfolder/index.php [L]