Score:2

What does the sshd process from "ps aux" mean? Can I reconnect to it?

ng flag

I started using Elastic Cloud Computing on AWS and noticed that when I close and reopen my laptop my ssh session is stuck. When I re-ssh into the virtual machine, it opens up a new session.

I ssh into the server using ec2-user username.

I wonder why the old ssh session is still running and can I reconnect to it?

> ps aux

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root      2904  0.0  0.8 152692  8660 ?        Ss   20:28   0:00 sshd: ec2-user [priv]
ec2-user  2922  0.0  0.4 152692  4508 ?        S    20:28   0:00 sshd: ec2-user@pts/2
root      3217  0.0  0.7 112916  7804 ?        Ss   06:35   0:00 /usr/sbin/sshd -D
root      3393  0.0  0.8 152692  8604 ?        Ss   22:26   0:00 sshd: ec2-user [priv]
ec2-user  3411  0.0  0.4 152692  4544 ?        S    22:26   0:00 sshd: ec2-user@pts/0
ec2-user  3439  0.0  0.0 119424   932 pts/0    S+   22:26   0:00 grep --color=auto sshd

> ps auxwwf

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root     10472  0.0  0.8 152692  8516 ?        Ss   01:11   0:00  \_ sshd: ec2-user [priv]
ec2-user 10490  0.0  0.4 152692  4548 ?        S    01:11   0:00  |   \_ sshd: ec2-user@pts/0
ec2-user 10491  0.0  0.5 149940  5232 pts/0    Ss+  01:11   0:00  |       \_ zsh
root     10671  0.0  0.8 152692  8396 ?        Ss   01:17   0:00  \_ sshd: ec2-user [priv]
ec2-user 10689  0.0  0.4 152692  4352 ?        S    01:17   0:00  |   \_ sshd: ec2-user@pts/1
ec2-user 10690  0.0  0.3 124864  3936 pts/1    Ss+  01:17   0:00  |       \_ -bash
root     10774  0.0  0.8 152692  8560 ?        Ss   01:20   0:00  \_ sshd: ec2-user [priv]
ec2-user 10792  0.0  0.3 152692  3532 ?        S    01:20   0:00  |   \_ sshd: ec2-user@pts/2
ec2-user 10793  0.0  0.3 124864  3768 pts/2    Ss+  01:20   0:00  |       \_ -bash
root     14264  0.0  0.8 152692  8720 ?        Ss   02:13   0:00  \_ sshd: ec2-user [priv]
ec2-user 14282  0.0  0.4 152692  4540 ?        S    02:13   0:00      \_ sshd: ec2-user@pts/3
ec2-user 14283  0.0  0.5 152464  5688 pts/3    Ss   02:13   0:00          \_ -zsh
ec2-user 14311  0.0  0.4 164524  4036 pts/3    R+   02:19   0:00              \_ ps auxwwf
root      3254  0.0  0.0   4264   108 ?        Ss    2021   0:00 /usr/sbin/acpid
ec2-user  5688  0.0  1.8 370484 18460 ?        S     2021   0:11 python3 -m http.server
A. Darwin avatar
my flag
Can you post the output of "ps auxwwf"?
Chuan avatar
ng flag
@A.Darwin I have updated the question
Score:0
cn flag

No, it is not practical to recover a ssh session after a disconnect.

Consider using a terminal "detach" utility, like tmux or GNU screen. On reconnect these make it easy to reattach to a session. They also have window manager features.

Chuan avatar
ng flag
When a session is disconnected why are there still running sshd processes?
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.