무엇 SSH_TTY과 SSH_CONNECTION변수에 대한? 내 우분투 시스템에서는 둘 다 비어 있습니다. 그들은 어떤 가치를 가져야합니까?
무엇 SSH_TTY과 SSH_CONNECTION변수에 대한? 내 우분투 시스템에서는 둘 다 비어 있습니다. 그들은 어떤 가치를 가져야합니까?
답변:
에서 ssh매뉴얼 페이지
SSH_CONNECTION
Identifies the client and server ends of the connection.
The variable contains four space-separated values: client IP address,
client port number, server IP address, and server port number.
....
SSH_TTY
This is set to the name of the tty (path to the device) associated
with the current shell or command. If the current session has no tty,
this variable is not set.
ssh 세션이 아니므로 이러한 변수는 설정되지 않습니다.
man bash해당 변수의 의미를 입력 하고 검색 할 수 있습니다 . ssh 세션에 있는지 여부에 관계없이 항상 설정됩니다.
다른 사람들이 언급했듯이 이러한 변수는 세션을 만들 때만 설정됩니다. 이를 직접 확인하려면 활성 SSH 세션에서 값을 검사하십시오.
ssh user@host 'echo SSH_TTY: $SSH_TTY SSH_CONNECTION: $SSH_CONNECTION'