where is the point the client command is executed?

Zhang Kexin kzhang at redhat.com
Tue Apr 17 15:09:57 EST 2007


On Tue, 2007-04-17 at 13:45 +1000, Darren Tucker wrote:
> Zhang Kexin wrote:
> > Hi,
> > 
> > I met some difficult in reading ssh/sshd souce code, I want to
> > find out how the command that user input in client is executed on the
> > server. I only found out the process_input function put the command in a
> > buffer,but can not find how it is executed. Could you please help me on
> > that?
> 
> You mean when you run "ssh someserver echo foo" or similar?
I mean after I have connected to server successfully, when I input "ls"
in client, how the command is executed. Your explain is exactly what i'm
looking for. But I need more explain.
> 
> Look in session.c in do_exec() and do_exec_no_pty().  Ultimately it will 
> end up running the command via the user's shell via execve(1) after 
> setting up its environment, descriptors and such.
I looked do_exec_no_pty, is do_child(s, command) the place the command is executed?
There are two execve's in do_child, one is for fork a shell, the other
execve, it seems never invoked. So I still do not know how  where
command is executed.


> > Thank you very much.
> 
> You're welcome.
Thank again.
> 



More information about the openssh-unix-dev mailing list