Method PreventNewSessionsAsync
- Namespace
- SshSharp
- Assembly
- SshSharp.dll
PreventNewSessionsAsync(CancellationToken)
Opens no more sessions on this connection (commands, shells, SFTP), and tells an OpenSSH server to refuse any as well, as ssh does
once it knows it will not open another (OpenSSH's no-more-sessions@openssh.com): a process that later gets hold of this
connection cannot quietly start a session on it, and an OpenSSH server drops the connection if one is tried anyway. Sessions already
open, port forwarding and tunnels are unaffected. Like ssh, the request goes only to OpenSSH servers (some others abort on it);
with others, only this client refuses.
public Task<bool> PreventNewSessionsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationToken
Returns
Exceptions
- SshException
The connection is closed or failed meanwhile.