Ethical Hacking

Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package.
Computer Forensics Training at InfoSec Institute

Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors.




Network Security Secure-Shell
[Top] [All Lists]

Re: Arriving at a specified directory instead of the user's home

Subject: Re: Arriving at a specified directory instead of the user's home
Date: Mon, 12 Mar 2007 19:03:55 +0000
That's easy. Just create this script, calling it something
like /usr/local/bin/arrive

#! /bin/sh
# Go to the requested directory
cd ${1}
# Find out the user's preferred shell and execute it
exec `getent passwd $USER|sed -e 's|.*:\(.*\)$|\1|'`

Then, to login, type

ssh -t [your usual ssh parameters] /usr/local/bin/arrive ~/local/mystuff

(You can omit the directory, /usr/local/bin in this case, if it's on
the user's PATH.)

It works for me. Let me know if for some reason it doesn't work on your
system. Note that you need to specify -t in order to get a proper
terminal allocated - since you're using a script, openssh assumes that
you won't need a proper terminal, so you have to tell it otherwise.
-- 
Robin

On Sat, 10 Mar 2007 05:10:18 -0800 (PST)
agostonbejo <bejoag1@yahoo.com> wrote:


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 user1@themachine
password: ...
user1@themachine:/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


-- 
Robin

<Prev in Thread] Current Thread [Next in Thread>