Information on command execution in sshd

Alex Bligh alex at
Mon Oct 3 04:38:31 EST 2011

--On 2 October 2011 05:22:23 -0700 titu senapati <titu_senapati at> 

> I was going through the code of open ssh server part ( code for sshd ).
> My query is when user gives any command ( for example unix command "ls")
> in the console ( after ssh login is complete ), which function in sshd
> will execute this command.

Assuming by "ssh login" you mean login in the sense of an interactive
shell, ssh runs bash (or whatever shell the user has set up). It then
passes stdin to bash over the ssh channel and prints stdout. Thus ssh
isn't executing the commands, it's just passing them to an existing
shell through an fd.

Alex Bligh

More information about the openssh-unix-dev mailing list