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



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@xxxxxxxxx> 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



Relevant Pages

  • Re: Will Linux become as vulnerable as MS ??
    ... > beeing vulnerable to viruses. ... > that they know are executable, and execute intentionally. ... >> Linux, each distro is a little different, and even within the distro, ... > Since clicking on a script is easier than typing it's name, ...
    (comp.os.linux.security)
  • Re: Small, understandable Forth
    ... intelligence from the word to the script. ... niclos file script files, but only in the directory in which they are ... \ there are required support vocabularies, ... RDROP EXECUTE DEFINITIONS; ...
    (comp.lang.forth)
  • [RT-SA-2014-008] Python CGIHTTPServer File Disclosure and Potential Code Execution
    ... The CGIHTTPServer Python module does not properly handle URL-encoded ... script's source code or execute arbitrary CGI scripts in the server's ... A sample server script in Python may look like the ... This server should execute any scripts located in the subdirectory ...
    (Bugtraq)
  • Re: [Full-Disclosure] ColdFusion cross-site scripting security vulnerability of an error page
    ... > execute the arbitrary javascript and HTML code which the attacker ... > It is possible to display the contents transmitted from the client ... > cross-site scripting attack can be executed. ... the script will be executed when the script for an attack ...
    (Full-Disclosure)
  • CGIscript.net - csMailto.cgi - Remote Command Execution
    ... CGIscript.net - csMailto.cgi - Remote Command ... csMailto is a perl cgi formmail script developed by ... execute command on server and mail output to anyone ...
    (Bugtraq)