sshd 如何知道调用 shell?

yeg*_*gle 3 ssh bash

当我输入时ssh remote-host commandsshdbash -c command为我跑。

怎么sshd知道bash-coption调用?

yeg*_*gle 7

哦该死,这是在 OpenSSH 的源代码中硬编码的。

来自 OpenSSH 5.9p1 源代码的 session.c:

/*
 * Execute the command using the user's shell.  This uses the -c
 * option to execute the command.
 */
argv[0] = (char *) shell0;
argv[1] = "-c";
argv[2] = (char *) command;
argv[3] = NULL;
execve(shell, argv, env);
perror(shell);
exit(1);
Run Code Online (Sandbox Code Playgroud)

所以我想这是一个 POSIX 标准吧?