In article <[EMAIL PROTECTED]>,
Kamaraju Kusumanchi <[EMAIL PROTECTED]> 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?
Try this:
ssh -t [EMAIL PROTECTED] 'cd / && exec /bin/bash'
The '-t' forces allocation of a tty, which is probably what
confused you wrt "it seems to be hanging" - you didn't get a prompt.
The "sh -c" isn't neccesary as ssh already executes a shell,
and the '&&' makes sure that the final shell is only run if
the cd / (or cd /what/ever) succeeds.
Mike.
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]