[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Get the pid of the shh session



----- Original Message -----
> From: "Bruno Buzzi Brassesco" <bruno.brasesco@xxxxxxxxx>
> To: libssh@xxxxxxxxxx
> Sent: Friday, July 17, 2020 3:25:11 PM
> Subject: Get the pid of the shh session
> 
> Hi,

Hello,

> 
> Is there any way to get the PID of the open session ?

The PID would be the same as the process which opened the session. libssh doesn't fork.

libssh doesn't provide an API to get the pid of the process, it is out of the scope for the library. You should use platform specific API, such as getpid() on Linux.

> 
> The following function ssh_dump_knownhost (i know is deprecated) answer:
> 192.168.132.128 ssh-ed25519
> AAAAC3NzaC1lZDI1NTE5AAAAIDV8oNhqjtEfNSY+RnHo05uPRgAM/+Z5ahs7ZBrWMPiD
> 
> But it seems that 25519 is not a PID (not listed in ps -aux).

No, 25519 is not the PID. ssh-ed25519 refers to the key type, in this case EdDSA on Curve25519 curve. See [1].

> 
> Also there is "PiD" at the end of the string but not sure about the meaning.

You were basically "lucky": that is part of the base64-encoded key.

Regards,
Anderson

[1] https://en.wikipedia.org/wiki/EdDSA


Follow-Ups:
Re: Get the pid of the shh sessionBruno Buzzi Brassesco <bruno.brasesco@xxxxxxxxx>
References:
Get the pid of the shh sessionBruno Buzzi Brassesco <bruno.brasesco@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org