Focus on cloud service provider activities
Notes on website operation and maintenance

Solve the problem that VPS cannot log in to SSH and SFTP clients after restarting the AMH panel environment

AMH panel As one of the Linux VPS host panels developed by Chinese people, the current number of users is relatively large. Even though there have been many controversies since the new version began charging last year, it is basically getting used to. Because the free version of 4.2 can basically meet the needs of ordinary website users. If you have money or need other functional applications, you can purchase the paid version.

Lao Zuo has also met before AMH In the VPS of the panel, if VPS is restarted or other applications are upgraded, it may be impossible to connect when you log in to SSH or SFTP again. At first, it was considered to be an accidental coincidence. Last week, after Captain told you AMH The port settings of the panel need to be loaded into the configuration file. If our VPS modifies the SSH port after installing the AMH panel and does not load the configuration file, the VPS will restart, causing the port settings to fail.

Therefore, if we are going to install the AMH panel environment in the Linux VPS host, we can refer to two methods.

First, modify the SSH port configuration before installing the AMH panel

After upgrading the VPS system and some basic security measures, we can modify the SSH port before installing the panel, and finally install the AMH panel after the settings are OK.

Second, how to set after installing the AMH panel

Lao Zuo used to configure ports and deal with VPS details after the configuration panel was installed without problems. Then we can't set a new port like the general VPS environment, and then save the port. We also need to load it into the configuration file. The details are as follows:

A - /etc/ssh/sshd_config

Modify this file, find the port, change the default 22 to the port we need, and then execute the command to take effect.

    #centos
/etc/init.d/sshd restart

#Debian or ubuntu
/etc/init.d/ssh restart

There is no problem if there is no error in executing the command. If there is an error, we will see an error prompt. If the port conflicts with a number, it needs to be replaced.

B - Save the configuration port

/Sbin/iptables - I INPUT - p tcp -- port number set by dport - j ACCEPT;
/sbin/iptables-save > /etc/amh-iptables;

/sbin/iptables-restore < /etc/amh-iptables;

It is useless for us to save directly. You need to save it to/etc/amh iptables in the AMH configuration file.

In this way, whether we restart or modify the configuration file, we will not cause the set port to fail.

Domain name host preferential information push QQ group: six hundred and twenty-seven million seven hundred and seventy-five thousand four hundred and seventy-seven Get preferential promotion from merchants.
Like( zero )
Do not reprint without permission: Lao Zuo's Notes » Solve the problem that VPS cannot log in to SSH and SFTP clients after restarting the AMH panel environment


Scan the code to follow the official account

Get more news about webmaster circle!
Entrepreneurship, operation and new knowledge