当我输入ssh remote-host命令时,sshd将为我运行bash -c命令.
sshd如何知道使用-c选项调用bash?
哦该死的,这是在OpenSSH的源代码中硬编码的.
原文链接:https://www.f2er.com/bash/385355.html来自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);
所以我猜这是一个POSIX标准吧?