Host Management
Introduction
Manage and maintain the hosts that the platform can operate. When adding a host for the first time, you need to enter the password of the specified user of ssh
.
Principle Description
Spug
will try to connect to the target host directly through the key when adding a host for the first time, and there will be the following 3 possibilities:
- If the target host does not support key authentication, an exception (error code
E01
) will be thrown directly and the request will be terminated. - If the key authentication is successful, the host is added directly and the process is completed.
- If the key authentication fails, a password input box will pop up, and the user will enter the password and set the key authentication (if the target host does not support password authentication, an exception (error code
E00
) will be thrown directly and the request will be terminated).
In the third case, the user enters the password, and Spug
tries to connect to the target host through the password after receiving the password and execute the following command to set the key authentication
mkdir -p -m 700 ~/.ssh
echo 'public key content ....' >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
After the above operation, Spug
will try to connect to the target host using the key again, and there will be the following 2 possibilities:
- Authentication fails, an exception (error code
E02
) is thrown directly and the request is terminated. - Authentication succeeds, the complete host is added.
Error Description
E00
Indicates that the target host does not support password authentication. You can usually try to view thesshd
configuration file/etc/ssh/sshd_config
of the target host to ensure thatPasswordAuthentication yes
.
E01
Indicates that the target host does not support key authentication. You can usually try to view thesshd
configuration file/etc/ssh/sshd_config
of the target host to ensure thatPubkeyAuthentication yes
.E02
AfterSpug
tries to set the key authentication, it still cannot connect to the host normally through the key. You can try the following checks.- User home directory such as
/root
directory permissions are 700 ~/.ssh
directory permissions are 700, file permissions 600- The owner and group of the above files are the current user
- Check the SSH system log, for example Centos is located at
/var/log/secure
- If you can manually operate to achieve key authentication, you can try to achieve key authentication yourself, and then add the host again after the test is passed
- If the above are all checked and it still doesn't work, feel free to feedback to us
- User home directory such as