Digital Ocean - Regularly get disconnected from Digital Ocean Ubuntu 16.04 [closed]











up vote
0
down vote

favorite












I've been trying out Digital Ocean for the last couple of days. I manage to ssh without issues, but after 5-10 minutes, the connection breaks with message: root@my_droplet:~# Connection reset by xxx.xxx.xxx.xxx port 22



As indicated by an answer to another question, I tried to identify the issue by examining log file at /var/log/auth.log. Below, is the log from when I logged in today.



Nov 26 12:07:49 my_droplet sshd[23219]: Accepted publickey for root from xxx.xxx.xxx.xxx port 54365 ssh2: RSA SHA256:[some_key]
Nov 26 12:07:49 my_droplet sshd[23219]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:07:49 my_droplet systemd-logind[756]: New session 921 of user root.
Nov 26 12:10:33 my_droplet sshd[23322]: Accepted publickey for root from xxx.xxx.xxx.xxx port 54374 ssh2: RSA SHA256:[some_key]
Nov 26 12:10:33 my_droplet sshd[23322]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:10:33 my_droplet systemd-logind[756]: New session 922 of user root.
Nov 26 12:10:58 my_droplet sshd[23401]: Invalid user oracle from xxx.xxx.xxx.xxx port 42076
Nov 26 12:10:58 my_droplet sshd[23401]: Received disconnect from xxx.xxx.xxx.xxx port 42076:11: Bye Bye [preauth]
Nov 26 12:10:58 my_droplet sshd[23401]: Disconnected from invalid user oracle xxx.xxx.xxx.xxx port 42076 [preauth]
Nov 26 12:17:01 my_droplet CRON[23405]: pam_unix(cron:session): session opened for user root by (uid=0)
Nov 26 12:17:01 my_droplet CRON[23405]: pam_unix(cron:session): session closed for user root
Nov 26 12:22:34 my_droplet sshd[23409]: Invalid user ttt from xxx.xxx.xxx.xxx port 55188
Nov 26 12:22:34 my_droplet sshd[23409]: Received disconnect from xxx.xxx.xxx.xxx port 55188:11: Bye Bye [preauth]
Nov 26 12:22:34 my_droplet sshd[23409]: Disconnected from invalid user ttt xxx.xxx.xxx.xxx port 55188 [preauth]
Nov 26 12:24:35 my_droplet sshd[23412]: Accepted publickey for root from xxx.xxx.xxx.xxx port 58785 ssh2: RSA SHA256:[some_key]
Nov 26 12:24:35 my_droplet sshd[23412]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:24:35 d3 systemd-logind[756]: New session 924 of user root.


I'm a bit confused by the invalid user messages below (my user is 'root'). Also, the log file suggests that invalid users logs have been made every minute from when the log file starts.










share|improve this question















closed as unclear what you're asking by Rui F Ribeiro, RalfFriedl, Jeff Schaller, Isaac, JigglyNaga Nov 27 at 13:39


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 3




    Happy DO user here. Use ssh -vv ... when connecting to get more info, and if you can't figure that out yourself call their support, they are rather helpful. See here
    – xenoid
    Nov 26 at 13:18






  • 2




    Does it close the connection while you're doing nothing, or only after you type something to a connection that has been idle for awhile?
    – Mark Plotnick
    Nov 26 at 17:09










  • The "invalid user" lines are scripting bots attempting to try to gain access using lists of usernames and passwords. Try last for listing your logins and lastb to list the brute force username/password attempts.
    – RubberStamp
    Nov 26 at 20:52










  • @xenoid Your link points back to this question.
    – JigglyNaga
    Nov 27 at 13:39










  • Got results for grep ClientAliveCountMax /etc/ssh/sshd_config and grep ClientAliveInterval /etc/ssh/sshd_config? Or in the client-side ~/.ssh/ssh_config or /etc/ssh/ssh_config?
    – Christopher
    Nov 27 at 21:24

















up vote
0
down vote

favorite












I've been trying out Digital Ocean for the last couple of days. I manage to ssh without issues, but after 5-10 minutes, the connection breaks with message: root@my_droplet:~# Connection reset by xxx.xxx.xxx.xxx port 22



As indicated by an answer to another question, I tried to identify the issue by examining log file at /var/log/auth.log. Below, is the log from when I logged in today.



Nov 26 12:07:49 my_droplet sshd[23219]: Accepted publickey for root from xxx.xxx.xxx.xxx port 54365 ssh2: RSA SHA256:[some_key]
Nov 26 12:07:49 my_droplet sshd[23219]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:07:49 my_droplet systemd-logind[756]: New session 921 of user root.
Nov 26 12:10:33 my_droplet sshd[23322]: Accepted publickey for root from xxx.xxx.xxx.xxx port 54374 ssh2: RSA SHA256:[some_key]
Nov 26 12:10:33 my_droplet sshd[23322]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:10:33 my_droplet systemd-logind[756]: New session 922 of user root.
Nov 26 12:10:58 my_droplet sshd[23401]: Invalid user oracle from xxx.xxx.xxx.xxx port 42076
Nov 26 12:10:58 my_droplet sshd[23401]: Received disconnect from xxx.xxx.xxx.xxx port 42076:11: Bye Bye [preauth]
Nov 26 12:10:58 my_droplet sshd[23401]: Disconnected from invalid user oracle xxx.xxx.xxx.xxx port 42076 [preauth]
Nov 26 12:17:01 my_droplet CRON[23405]: pam_unix(cron:session): session opened for user root by (uid=0)
Nov 26 12:17:01 my_droplet CRON[23405]: pam_unix(cron:session): session closed for user root
Nov 26 12:22:34 my_droplet sshd[23409]: Invalid user ttt from xxx.xxx.xxx.xxx port 55188
Nov 26 12:22:34 my_droplet sshd[23409]: Received disconnect from xxx.xxx.xxx.xxx port 55188:11: Bye Bye [preauth]
Nov 26 12:22:34 my_droplet sshd[23409]: Disconnected from invalid user ttt xxx.xxx.xxx.xxx port 55188 [preauth]
Nov 26 12:24:35 my_droplet sshd[23412]: Accepted publickey for root from xxx.xxx.xxx.xxx port 58785 ssh2: RSA SHA256:[some_key]
Nov 26 12:24:35 my_droplet sshd[23412]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:24:35 d3 systemd-logind[756]: New session 924 of user root.


I'm a bit confused by the invalid user messages below (my user is 'root'). Also, the log file suggests that invalid users logs have been made every minute from when the log file starts.










share|improve this question















closed as unclear what you're asking by Rui F Ribeiro, RalfFriedl, Jeff Schaller, Isaac, JigglyNaga Nov 27 at 13:39


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.











  • 3




    Happy DO user here. Use ssh -vv ... when connecting to get more info, and if you can't figure that out yourself call their support, they are rather helpful. See here
    – xenoid
    Nov 26 at 13:18






  • 2




    Does it close the connection while you're doing nothing, or only after you type something to a connection that has been idle for awhile?
    – Mark Plotnick
    Nov 26 at 17:09










  • The "invalid user" lines are scripting bots attempting to try to gain access using lists of usernames and passwords. Try last for listing your logins and lastb to list the brute force username/password attempts.
    – RubberStamp
    Nov 26 at 20:52










  • @xenoid Your link points back to this question.
    – JigglyNaga
    Nov 27 at 13:39










  • Got results for grep ClientAliveCountMax /etc/ssh/sshd_config and grep ClientAliveInterval /etc/ssh/sshd_config? Or in the client-side ~/.ssh/ssh_config or /etc/ssh/ssh_config?
    – Christopher
    Nov 27 at 21:24















up vote
0
down vote

favorite









up vote
0
down vote

favorite











I've been trying out Digital Ocean for the last couple of days. I manage to ssh without issues, but after 5-10 minutes, the connection breaks with message: root@my_droplet:~# Connection reset by xxx.xxx.xxx.xxx port 22



As indicated by an answer to another question, I tried to identify the issue by examining log file at /var/log/auth.log. Below, is the log from when I logged in today.



Nov 26 12:07:49 my_droplet sshd[23219]: Accepted publickey for root from xxx.xxx.xxx.xxx port 54365 ssh2: RSA SHA256:[some_key]
Nov 26 12:07:49 my_droplet sshd[23219]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:07:49 my_droplet systemd-logind[756]: New session 921 of user root.
Nov 26 12:10:33 my_droplet sshd[23322]: Accepted publickey for root from xxx.xxx.xxx.xxx port 54374 ssh2: RSA SHA256:[some_key]
Nov 26 12:10:33 my_droplet sshd[23322]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:10:33 my_droplet systemd-logind[756]: New session 922 of user root.
Nov 26 12:10:58 my_droplet sshd[23401]: Invalid user oracle from xxx.xxx.xxx.xxx port 42076
Nov 26 12:10:58 my_droplet sshd[23401]: Received disconnect from xxx.xxx.xxx.xxx port 42076:11: Bye Bye [preauth]
Nov 26 12:10:58 my_droplet sshd[23401]: Disconnected from invalid user oracle xxx.xxx.xxx.xxx port 42076 [preauth]
Nov 26 12:17:01 my_droplet CRON[23405]: pam_unix(cron:session): session opened for user root by (uid=0)
Nov 26 12:17:01 my_droplet CRON[23405]: pam_unix(cron:session): session closed for user root
Nov 26 12:22:34 my_droplet sshd[23409]: Invalid user ttt from xxx.xxx.xxx.xxx port 55188
Nov 26 12:22:34 my_droplet sshd[23409]: Received disconnect from xxx.xxx.xxx.xxx port 55188:11: Bye Bye [preauth]
Nov 26 12:22:34 my_droplet sshd[23409]: Disconnected from invalid user ttt xxx.xxx.xxx.xxx port 55188 [preauth]
Nov 26 12:24:35 my_droplet sshd[23412]: Accepted publickey for root from xxx.xxx.xxx.xxx port 58785 ssh2: RSA SHA256:[some_key]
Nov 26 12:24:35 my_droplet sshd[23412]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:24:35 d3 systemd-logind[756]: New session 924 of user root.


I'm a bit confused by the invalid user messages below (my user is 'root'). Also, the log file suggests that invalid users logs have been made every minute from when the log file starts.










share|improve this question















I've been trying out Digital Ocean for the last couple of days. I manage to ssh without issues, but after 5-10 minutes, the connection breaks with message: root@my_droplet:~# Connection reset by xxx.xxx.xxx.xxx port 22



As indicated by an answer to another question, I tried to identify the issue by examining log file at /var/log/auth.log. Below, is the log from when I logged in today.



Nov 26 12:07:49 my_droplet sshd[23219]: Accepted publickey for root from xxx.xxx.xxx.xxx port 54365 ssh2: RSA SHA256:[some_key]
Nov 26 12:07:49 my_droplet sshd[23219]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:07:49 my_droplet systemd-logind[756]: New session 921 of user root.
Nov 26 12:10:33 my_droplet sshd[23322]: Accepted publickey for root from xxx.xxx.xxx.xxx port 54374 ssh2: RSA SHA256:[some_key]
Nov 26 12:10:33 my_droplet sshd[23322]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:10:33 my_droplet systemd-logind[756]: New session 922 of user root.
Nov 26 12:10:58 my_droplet sshd[23401]: Invalid user oracle from xxx.xxx.xxx.xxx port 42076
Nov 26 12:10:58 my_droplet sshd[23401]: Received disconnect from xxx.xxx.xxx.xxx port 42076:11: Bye Bye [preauth]
Nov 26 12:10:58 my_droplet sshd[23401]: Disconnected from invalid user oracle xxx.xxx.xxx.xxx port 42076 [preauth]
Nov 26 12:17:01 my_droplet CRON[23405]: pam_unix(cron:session): session opened for user root by (uid=0)
Nov 26 12:17:01 my_droplet CRON[23405]: pam_unix(cron:session): session closed for user root
Nov 26 12:22:34 my_droplet sshd[23409]: Invalid user ttt from xxx.xxx.xxx.xxx port 55188
Nov 26 12:22:34 my_droplet sshd[23409]: Received disconnect from xxx.xxx.xxx.xxx port 55188:11: Bye Bye [preauth]
Nov 26 12:22:34 my_droplet sshd[23409]: Disconnected from invalid user ttt xxx.xxx.xxx.xxx port 55188 [preauth]
Nov 26 12:24:35 my_droplet sshd[23412]: Accepted publickey for root from xxx.xxx.xxx.xxx port 58785 ssh2: RSA SHA256:[some_key]
Nov 26 12:24:35 my_droplet sshd[23412]: pam_unix(sshd:session): session opened for user root by (uid=0)
Nov 26 12:24:35 d3 systemd-logind[756]: New session 924 of user root.


I'm a bit confused by the invalid user messages below (my user is 'root'). Also, the log file suggests that invalid users logs have been made every minute from when the log file starts.







ubuntu ssh






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 27 at 21:20









Rui F Ribeiro

38.4k1477127




38.4k1477127










asked Nov 26 at 12:44









user55

1




1




closed as unclear what you're asking by Rui F Ribeiro, RalfFriedl, Jeff Schaller, Isaac, JigglyNaga Nov 27 at 13:39


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by Rui F Ribeiro, RalfFriedl, Jeff Schaller, Isaac, JigglyNaga Nov 27 at 13:39


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.










  • 3




    Happy DO user here. Use ssh -vv ... when connecting to get more info, and if you can't figure that out yourself call their support, they are rather helpful. See here
    – xenoid
    Nov 26 at 13:18






  • 2




    Does it close the connection while you're doing nothing, or only after you type something to a connection that has been idle for awhile?
    – Mark Plotnick
    Nov 26 at 17:09










  • The "invalid user" lines are scripting bots attempting to try to gain access using lists of usernames and passwords. Try last for listing your logins and lastb to list the brute force username/password attempts.
    – RubberStamp
    Nov 26 at 20:52










  • @xenoid Your link points back to this question.
    – JigglyNaga
    Nov 27 at 13:39










  • Got results for grep ClientAliveCountMax /etc/ssh/sshd_config and grep ClientAliveInterval /etc/ssh/sshd_config? Or in the client-side ~/.ssh/ssh_config or /etc/ssh/ssh_config?
    – Christopher
    Nov 27 at 21:24
















  • 3




    Happy DO user here. Use ssh -vv ... when connecting to get more info, and if you can't figure that out yourself call their support, they are rather helpful. See here
    – xenoid
    Nov 26 at 13:18






  • 2




    Does it close the connection while you're doing nothing, or only after you type something to a connection that has been idle for awhile?
    – Mark Plotnick
    Nov 26 at 17:09










  • The "invalid user" lines are scripting bots attempting to try to gain access using lists of usernames and passwords. Try last for listing your logins and lastb to list the brute force username/password attempts.
    – RubberStamp
    Nov 26 at 20:52










  • @xenoid Your link points back to this question.
    – JigglyNaga
    Nov 27 at 13:39










  • Got results for grep ClientAliveCountMax /etc/ssh/sshd_config and grep ClientAliveInterval /etc/ssh/sshd_config? Or in the client-side ~/.ssh/ssh_config or /etc/ssh/ssh_config?
    – Christopher
    Nov 27 at 21:24










3




3




Happy DO user here. Use ssh -vv ... when connecting to get more info, and if you can't figure that out yourself call their support, they are rather helpful. See here
– xenoid
Nov 26 at 13:18




Happy DO user here. Use ssh -vv ... when connecting to get more info, and if you can't figure that out yourself call their support, they are rather helpful. See here
– xenoid
Nov 26 at 13:18




2




2




Does it close the connection while you're doing nothing, or only after you type something to a connection that has been idle for awhile?
– Mark Plotnick
Nov 26 at 17:09




Does it close the connection while you're doing nothing, or only after you type something to a connection that has been idle for awhile?
– Mark Plotnick
Nov 26 at 17:09












The "invalid user" lines are scripting bots attempting to try to gain access using lists of usernames and passwords. Try last for listing your logins and lastb to list the brute force username/password attempts.
– RubberStamp
Nov 26 at 20:52




The "invalid user" lines are scripting bots attempting to try to gain access using lists of usernames and passwords. Try last for listing your logins and lastb to list the brute force username/password attempts.
– RubberStamp
Nov 26 at 20:52












@xenoid Your link points back to this question.
– JigglyNaga
Nov 27 at 13:39




@xenoid Your link points back to this question.
– JigglyNaga
Nov 27 at 13:39












Got results for grep ClientAliveCountMax /etc/ssh/sshd_config and grep ClientAliveInterval /etc/ssh/sshd_config? Or in the client-side ~/.ssh/ssh_config or /etc/ssh/ssh_config?
– Christopher
Nov 27 at 21:24






Got results for grep ClientAliveCountMax /etc/ssh/sshd_config and grep ClientAliveInterval /etc/ssh/sshd_config? Or in the client-side ~/.ssh/ssh_config or /etc/ssh/ssh_config?
– Christopher
Nov 27 at 21:24












1 Answer
1






active

oldest

votes

















up vote
0
down vote













Dont Login as root:



Logging in as root may be convenient however, it is not good in practice.




Seems to me, that when the system trys to do a job as a user other than root, it is acting like root has logged out, or someone is trying to inappropriately change users and kicking you. Like if you execute an application as root from terminal, and you keep the terminal open while the app is running. The things that happen in the application are vissable in the terminal. I believe that something similar to this is happening. Where root must login anouther user to make changes, or a script calls a user other than root to be opened and the connection gets reset.




Create Sudo User:




  • If sudo is not installed install it apt-get install sudo


  • Create a user on the system useradd someusername , give that user sudo privilages usermod -aG sudo someusername and complete your maintenance tasks that way. So that the user that opened the connetion, has no other duties and need not be released until the connection is closed.



More info here: Digital Ocean: How To Create a Sudo User on Ubuntu



Setup PublickeyAuthentication



On the Client:




  • ssh-keygen -t rsa

  • ssh-copy-id <HOSTADDRESS>

  • Test that the key works.


On the Server:




  • edit /etc/ssh/sshd_config so that PublickeyAuthentication yes and PasswordAthentication no only if the key works.

  • service ssh restart


More info here: Digital Ocean: SSH Key Based Authentication






share|improve this answer



















  • 1




    This doesn't explain the disconnection. I have a server on DO, I login as root, and I don't get disconnected. Little purpose logging in as a random user if most of what you do on the server requires root privileges.
    – xenoid
    Nov 27 at 15:52










  • Not if you're having user-specific connection issues...
    – Michael Prokopec
    Nov 27 at 16:08


















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Dont Login as root:



Logging in as root may be convenient however, it is not good in practice.




Seems to me, that when the system trys to do a job as a user other than root, it is acting like root has logged out, or someone is trying to inappropriately change users and kicking you. Like if you execute an application as root from terminal, and you keep the terminal open while the app is running. The things that happen in the application are vissable in the terminal. I believe that something similar to this is happening. Where root must login anouther user to make changes, or a script calls a user other than root to be opened and the connection gets reset.




Create Sudo User:




  • If sudo is not installed install it apt-get install sudo


  • Create a user on the system useradd someusername , give that user sudo privilages usermod -aG sudo someusername and complete your maintenance tasks that way. So that the user that opened the connetion, has no other duties and need not be released until the connection is closed.



More info here: Digital Ocean: How To Create a Sudo User on Ubuntu



Setup PublickeyAuthentication



On the Client:




  • ssh-keygen -t rsa

  • ssh-copy-id <HOSTADDRESS>

  • Test that the key works.


On the Server:




  • edit /etc/ssh/sshd_config so that PublickeyAuthentication yes and PasswordAthentication no only if the key works.

  • service ssh restart


More info here: Digital Ocean: SSH Key Based Authentication






share|improve this answer



















  • 1




    This doesn't explain the disconnection. I have a server on DO, I login as root, and I don't get disconnected. Little purpose logging in as a random user if most of what you do on the server requires root privileges.
    – xenoid
    Nov 27 at 15:52










  • Not if you're having user-specific connection issues...
    – Michael Prokopec
    Nov 27 at 16:08















up vote
0
down vote













Dont Login as root:



Logging in as root may be convenient however, it is not good in practice.




Seems to me, that when the system trys to do a job as a user other than root, it is acting like root has logged out, or someone is trying to inappropriately change users and kicking you. Like if you execute an application as root from terminal, and you keep the terminal open while the app is running. The things that happen in the application are vissable in the terminal. I believe that something similar to this is happening. Where root must login anouther user to make changes, or a script calls a user other than root to be opened and the connection gets reset.




Create Sudo User:




  • If sudo is not installed install it apt-get install sudo


  • Create a user on the system useradd someusername , give that user sudo privilages usermod -aG sudo someusername and complete your maintenance tasks that way. So that the user that opened the connetion, has no other duties and need not be released until the connection is closed.



More info here: Digital Ocean: How To Create a Sudo User on Ubuntu



Setup PublickeyAuthentication



On the Client:




  • ssh-keygen -t rsa

  • ssh-copy-id <HOSTADDRESS>

  • Test that the key works.


On the Server:




  • edit /etc/ssh/sshd_config so that PublickeyAuthentication yes and PasswordAthentication no only if the key works.

  • service ssh restart


More info here: Digital Ocean: SSH Key Based Authentication






share|improve this answer



















  • 1




    This doesn't explain the disconnection. I have a server on DO, I login as root, and I don't get disconnected. Little purpose logging in as a random user if most of what you do on the server requires root privileges.
    – xenoid
    Nov 27 at 15:52










  • Not if you're having user-specific connection issues...
    – Michael Prokopec
    Nov 27 at 16:08













up vote
0
down vote










up vote
0
down vote









Dont Login as root:



Logging in as root may be convenient however, it is not good in practice.




Seems to me, that when the system trys to do a job as a user other than root, it is acting like root has logged out, or someone is trying to inappropriately change users and kicking you. Like if you execute an application as root from terminal, and you keep the terminal open while the app is running. The things that happen in the application are vissable in the terminal. I believe that something similar to this is happening. Where root must login anouther user to make changes, or a script calls a user other than root to be opened and the connection gets reset.




Create Sudo User:




  • If sudo is not installed install it apt-get install sudo


  • Create a user on the system useradd someusername , give that user sudo privilages usermod -aG sudo someusername and complete your maintenance tasks that way. So that the user that opened the connetion, has no other duties and need not be released until the connection is closed.



More info here: Digital Ocean: How To Create a Sudo User on Ubuntu



Setup PublickeyAuthentication



On the Client:




  • ssh-keygen -t rsa

  • ssh-copy-id <HOSTADDRESS>

  • Test that the key works.


On the Server:




  • edit /etc/ssh/sshd_config so that PublickeyAuthentication yes and PasswordAthentication no only if the key works.

  • service ssh restart


More info here: Digital Ocean: SSH Key Based Authentication






share|improve this answer














Dont Login as root:



Logging in as root may be convenient however, it is not good in practice.




Seems to me, that when the system trys to do a job as a user other than root, it is acting like root has logged out, or someone is trying to inappropriately change users and kicking you. Like if you execute an application as root from terminal, and you keep the terminal open while the app is running. The things that happen in the application are vissable in the terminal. I believe that something similar to this is happening. Where root must login anouther user to make changes, or a script calls a user other than root to be opened and the connection gets reset.




Create Sudo User:




  • If sudo is not installed install it apt-get install sudo


  • Create a user on the system useradd someusername , give that user sudo privilages usermod -aG sudo someusername and complete your maintenance tasks that way. So that the user that opened the connetion, has no other duties and need not be released until the connection is closed.



More info here: Digital Ocean: How To Create a Sudo User on Ubuntu



Setup PublickeyAuthentication



On the Client:




  • ssh-keygen -t rsa

  • ssh-copy-id <HOSTADDRESS>

  • Test that the key works.


On the Server:




  • edit /etc/ssh/sshd_config so that PublickeyAuthentication yes and PasswordAthentication no only if the key works.

  • service ssh restart


More info here: Digital Ocean: SSH Key Based Authentication







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 26 at 17:36

























answered Nov 26 at 16:53









Michael Prokopec

72316




72316








  • 1




    This doesn't explain the disconnection. I have a server on DO, I login as root, and I don't get disconnected. Little purpose logging in as a random user if most of what you do on the server requires root privileges.
    – xenoid
    Nov 27 at 15:52










  • Not if you're having user-specific connection issues...
    – Michael Prokopec
    Nov 27 at 16:08














  • 1




    This doesn't explain the disconnection. I have a server on DO, I login as root, and I don't get disconnected. Little purpose logging in as a random user if most of what you do on the server requires root privileges.
    – xenoid
    Nov 27 at 15:52










  • Not if you're having user-specific connection issues...
    – Michael Prokopec
    Nov 27 at 16:08








1




1




This doesn't explain the disconnection. I have a server on DO, I login as root, and I don't get disconnected. Little purpose logging in as a random user if most of what you do on the server requires root privileges.
– xenoid
Nov 27 at 15:52




This doesn't explain the disconnection. I have a server on DO, I login as root, and I don't get disconnected. Little purpose logging in as a random user if most of what you do on the server requires root privileges.
– xenoid
Nov 27 at 15:52












Not if you're having user-specific connection issues...
– Michael Prokopec
Nov 27 at 16:08




Not if you're having user-specific connection issues...
– Michael Prokopec
Nov 27 at 16:08



Popular posts from this blog

Morgemoulin

Scott Moir

Souastre