On Sun, Dec 05, 2004 at 05:33:14PM -0500, Kamaraju Kusumanchi wrote: > On Sun, 05 Dec 2004 17:18:54 -0500, David Mandelberg > <[EMAIL PROTECTED]> wrote: > > ssh [EMAIL PROTECTED] "sh -c 'cd dirname; exec somecommand'" > > > > somecommand is the command you want to run after cd'ing. E.g. if you > > want to run bash in / as joe at shell.example.net: > > > > ssh [EMAIL PROTECTED] "sh -c 'cd /; exec bash'" > > > > I tried this. It is not working. The machine seems to be hanging. Is > there any typo there?
It's not working here either. It's not hanging, but is waiting for more input, probably due to wrong quotes. At least I'm logged in at another console and can see no attempt at a second login. In my case a simple command like: ssh [EMAIL PROTECTED] ls works fine. So it seems a question of working out how the command should be quoted. When I do it like this: ssh [EMAIL PROTECTED] sh -c "cd /; bash" then it basically works. It doesn't give a prompt, but I can type commands on the remote machine. It can look like this: [EMAIL PROTECTED]:~$ hostname mauritsvanrees [EMAIL PROTECTED]:~$ ssh [EMAIL PROTECTED] sh -c "cd /; bash" hostname vanrees.org Wait, I notice that the `cd /' has no effect. In the original case it actually works, but also without the prompt, so I didn't notice at first. :) ssh [EMAIL PROTECTED] "sh -c 'cd /; exec bash'" and just start typing commands. How to get a decent prompt is left as an exercise to the reader. :) -- Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands] "Let your advance worrying become advance thinking and planning." - Winston Churchill -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

