package
Check if the process is running in an SSH session
npm install is-in-sshGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Check if the process is running in an SSH session
Useful for determining if your Node.js process is being executed over SSH, which can affect how you handle operations like opening files, browsers, or using system-specific commands.
npm install is-in-sshimport isInSsh from 'is-in-ssh';
if (isInSsh) {
console.log('Running in an SSH session');
}The package detects SSH sessions by checking for the presence of standard SSH environment variables:
SSH_CONNECTIONSSH_CLIENTSSH_TTYThese variables are automatically set by SSH servers when establishing a connection.
true for ssh localhost connections (which are technically SSH sessions)sudo)Estimated unpacked size across 1 packages.
3.5 kB
Includes dependencies.