Wednesday, October 14, 2015

When ssh to remote host, how can I know the bash pid running on remote host?

When I ssh to a remote host, Is it possible that I get the remote bash pid in my local machine? or vice versa?



for example on local terminal, I simply do ssh and keep connection to run my tasks:



ssh user@remote.com



and the ps is like this on local machine:



ps faux
...
shunh 32683 0.1 0.0 121148 5116 pts/2 Ss 07:02 0:00 \_ -bash
shunh 33079 0.6 0.0 189360 8484 pts/2 S+ 07:03 0:00 \_ ssh -X remote_host


and on remote_host:




ps faux
...
root 214679 0.0 0.0 158820 5724 ? Ss 07:03 0:00 \_ sshd: shunh [priv]
shunh 214681 0.0 0.0 158820 2556 ? S 07:03 0:00 \_ sshd: shunh@pts/1
shunh 214682 0.0 0.0 121124 3608 pts/1 Ss 07:03 0:00 \_ -bash


So can I get the pid number "214682" in my local machine?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...