What Should I Do If a Remote Connection Fails with the Error "Authentication failed"?
Symptom
Authentication failed is displayed during remote connection.
Possible Causes
The username, IP address, or port number is incorrect.
Solution
- Check whether the username, IP address, and port number of the target host are correct.
- In CodeArts Agent IDE, click
to go to the remote development page. - Hover the cursor over the connection to verify the username, IP address, and port number.
You can also click
on the remote connection to go to the connection editing page.The password is the login password of the corresponding Linux account, and the port is the SSH connection port. For a common Linux host, the default port is 22. For a remote Docker container, the mapped port is used.
- In CodeArts Agent IDE, click
- Modify the configuration based on the error message.
- Invalid username or password
The selected authentication mode is password authentication. If the selected mode is correct, check whether the username and password are correct and whether PasswordAuthentication is enabled (the default value is yes) in the /etc/ssh/sshd_config file on the remote host. If you log in as the root user, check whether PermitRootLogin is enabled (the default value is yes) in the /etc/ssh/sshd_config file on the remote host.
- Invalid username or private key
The selected authentication mode is key authentication. If the selected mode is correct, check whether the username and key file are correct and whether PubkeyAuthentication is enabled (set to yes) in the /etc/ssh/sshd_config file on the remote host.
- Your password has expired/The password has probably expired
The selected authentication mode is password authentication. If the selected mode is correct, the account or password has expired. You can log in to the target host as the administrator and run the chage command to view and change the account or password expiration time. Related commands are as follows:
# Check the password expiration time of a user. chage -l [user] # Set the maximum number of days during which the password of a user is valid (99999). chage -M 99999 [user] # Change the password expiration date of a user. After this date, the account will be unavailable. The value 0 indicates that the password will expire immediately, and the value -1 indicates that the password will never expire. chage -E "2025-09-25" [user]
- Invalid password or root is not allowed to log in
Since you log in as the root user, check whether PermitRootLogin is enabled (the default value is yes) in the /etc/ssh/sshd_config file on the remote host. If it is not enabled, modify the file and run the service sshd restart or sudo systemctl restart sshd command to restart the SSH service.
- Invalid username or password
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot