Disconnecting while logging into the remote server
When attempting to log in to a server from the backend, it encounters disconnection issues.
Follow the below steps to resolve the error
1.Tail the latest ezsh log of the user who attempted to log in to the server. Replace the username with the actual one.
root@admod:~# tail -f /home/username/ezsh.log
OR
Tail the latest application and try to replicate the same error that get before. Replace the latest_log
root@admod:~# tail -f /var/www/ezlogin/application/logs/latest_log
2. If get these type of error in the log, then follow the steps outlined below to resolve the issue.
root@admod:~# tail -f /home/linda/ezsh.log
New session started from 69.90.223.10:55130 to 10.10.8.21:22 on Wed Feb 28 01:52:58 2024
Query failed (INSERT INTO `emhpp_sshlogs` (`user_id`, `server_id`, `serveractivity_id`, `ssh_user`, `type`, `status`, `file`, `encryption`, `mexecid`, `created`) VALUES ('49', '2728', '0', 'root', 'input', 'begin', '/var/log/ezlogin/input/linda/root~cwh27.admod.com~Wed_Feb_28_01:53:19_2024', '1', '', NOW())): Error 1062: Duplicate entry '1248166' for key 'PRIMARY'
SSH log entry (/var/log/ezlogin/input/linda/root~admod.com~Wed_Feb_28_01:53:19_2024) creation failed: 0
a) Identify the duplicate entry in the table mentioned in the ezsh.log and log into MySQL
b) Add a new column named 'id' to the INSERT query and provide a value for the 'id' column by incrementing the duplicate entry mentioned in ezsh.log by one. Replace the values of ( `id`, `user_id`, `server_id`, `serveractivity_id`, `ssh_user`, `type`, `status`, `file`, `encryption`, `mexecid`, `created`) with the actual values.
mysql> INSERT INTO `emhpp_sshlogs` ( `id`, `user_id`, `server_id`, `serveractivity_id`, `ssh_user`, `type`, `status`, `file`, `encryption`, `mexecid`, `created`) VALUES ('1248167', '49', '2728', '0', 'root', 'input', 'begin', 'path_to_file', '1', '', NOW());
c) Delete the previously created entry from the table using a DELETE query. Replace "table_name" and "value" with the correct values. This will set the increment value correctly.
mysql> delete from table_name where id= value;
Example: mysql> delete from emhpp_sshlogs where id= 1248167;
3. Attempt to log in to the server that disconnected during the login attempt.
Related Articles
Upgrade Ezeelogin Jump server to the latest version
Basic MySQL commands for troubleshooting database related issues in Ezeelogin