Why would you want to do this? If you are ssh'ing into arbitrary directories as root (? - again why) then the user is irrelevant - unless you are doing something else? First of all, set up ssh so that there is public key exchange, rather than entering a password all the time (put your key into the right file under ~/.ssh/ ) then just do
ssh host.domain.etc "cd /dir/you/want" You may/may not need a -c switch in between. You will probably need the quotes so that the remote shell does not interpret the command as two separate args. Good luck. Dr Joe Haskian -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of agostonbejo Sent: Sunday, March 11, 2007 12:10 AM To: [email protected] Subject: Arriving at a specified directory instead of the user's home Hi! By default when I ssh onto a machine, I arrive at the user's home directory. Can I somehow specify upon ssh'ing that I would like to arrive at a different one? Something like this: ssh -target-directory=~/local/mystuff [EMAIL PROTECTED] password: ... [EMAIL PROTECTED]:/local/mystuff # ... Setting up the target directory permanently won't do, because it varies where I would like to arrive. Can it be done somehow? P.S.: This is the version I'm using: "OpenSSH_4.2p1, OpenSSL 0.9.8a 11 Oct 2005" Thanks! Agoston -- View this message in context: http://www.nabble.com/Arriving-at-a-specified-directory-instead-of-the-user% 27s-home-tf3380890.html#a9410209 Sent from the SSH (Secure Shell) mailing list archive at Nabble.com.
