Como o sshd sabe invocar o shell?

3

Quando digito ssh remote-host command , sshd executará bash -c command para mim.

Como o sshd sabe chamar a opção bash with -c ?

    
por yegle 24.12.2011 / 12:44

1 resposta

7

Oh caramba, isso é codificado no código-fonte do OpenSSH.

De session.c do código fonte do OpenSSH 5.9p1:

/*
 * 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);

Então eu acho que esse é um padrão POSIX hein?

    
por 24.12.2011 / 13:08

Tags