…with an open minded approach

Posts tagged “detect

Detect ssh login from ~/.bashrc

When you login with ssh, your environment gets 2 variables defined: SSH_CONNECTION and SSH_TTY

A simple way to detect if you are inside a bash session, established from ssh-login, is to check these vars

You can put this check inside ~/.bashrc, so that it executes in all new bash-logins, so that when a ssh-login is detected you can make something happen 🙂

This is a simple hack to detect normal ssh-logins, but dont use this for anything too important 🙂