linux确认进程运行环境是否为ssh远程连接

check if this command coming from sshd.

process

1
cat /proc/$PPID/status | head -1 | cut -f2

SSH environment variable

1
2
3
echo $SSH_CLIENT
echo $SSH_CONNECTION
# ubuntu desktop: they are not existed

who am i

1
who am i

graphic environ

1
2
3
echo $DISPLAY
# ssh : None
# ubuntu desktop: ":0"