[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: login into a particular directory using ssh



On Sun, Dec 05, 2004 at 05:18:54PM -0500, David Mandelberg wrote:
> ssh user@hostname "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 joe@shell.example.net "sh -c 'cd /; exec bash'"

Alternatively, if you *always* want to start in that directory, you
can edit the .bash_profile or similar on the remote machine. Just add
`cd <some directory>'.

-- 
Maurits van Rees | http://maurits.vanrees.org/ [Dutch/Nederlands]
"Let your advance worrying become advance thinking and planning."
 - Winston Churchill



Reply to: