什么是 "starting from sshd"?
What is "starting from sshd"?
我的 /etc/bash.bashrc
默认包含此代码(Git for Windows)
# If started from sshd, make sure profile is sourced
if [[ -n "$SSH_CONNECTION" ]] && [[ "$PATH" != *:/usr/bin* ]]; then
. /etc/profile
fi
我知道它被记录在案,但我还是不明白它的意思。我在 if 中设置了一个 echo "here"
以查看它是否运行过,但我无法运行。这到底是什么意思,甚至什么是 sshd?还是我不小心在键盘上输入了“d”而打错了字?
sshd
is the OpenSSH server process. It listens to incoming connections using the SSH protocol and acts as the server for the protocol. It handles user authentication, encryption, terminal connections, file transfers, and tunneling.
该代码检查是否设置了 $SSH_CONNECTION
环境变量以查看 shell 是否由 sshd 启动。如果是这样,并且 $PATH
不包含 /usr/bin
,那么它将在当前 shell 上下文中执行 /etc/profile
中的命令。
我的 /etc/bash.bashrc
默认包含此代码(Git for Windows)
# If started from sshd, make sure profile is sourced
if [[ -n "$SSH_CONNECTION" ]] && [[ "$PATH" != *:/usr/bin* ]]; then
. /etc/profile
fi
我知道它被记录在案,但我还是不明白它的意思。我在 if 中设置了一个 echo "here"
以查看它是否运行过,但我无法运行。这到底是什么意思,甚至什么是 sshd?还是我不小心在键盘上输入了“d”而打错了字?
sshd
is the OpenSSH server process. It listens to incoming connections using the SSH protocol and acts as the server for the protocol. It handles user authentication, encryption, terminal connections, file transfers, and tunneling.
该代码检查是否设置了 $SSH_CONNECTION
环境变量以查看 shell 是否由 sshd 启动。如果是这样,并且 $PATH
不包含 /usr/bin
,那么它将在当前 shell 上下文中执行 /etc/profile
中的命令。