Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
How to ssh and cd to the current directory?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Peng Yu  
View profile  
 More options Oct 10 2009, 11:03 am
Newsgroups: comp.security.ssh
From: Peng Yu <pengyu...@gmail.com>
Date: Sat, 10 Oct 2009 08:03:08 -0700 (PDT)
Local: Sat, Oct 10 2009 11:03 am
Subject: How to ssh and cd to the current directory?
ssh by default only goes to the home directory ~. I'm wondering if
there is a way to supply a directory (that is /home/name/some_dir in
this case) to it, so that it will go to the directory directly.

$pwd
/home/name/some_dir
$ssh localhost # I want to change the directory to /home/name/some_dir
after sshed to localhost
$pwd
/home/name


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nico Kadel-Garcia  
View profile  
 More options Oct 10 2009, 12:44 pm
Newsgroups: comp.security.ssh
From: Nico Kadel-Garcia <nka...@gmail.com>
Date: Sat, 10 Oct 2009 09:44:08 -0700 (PDT)
Local: Sat, Oct 10 2009 12:44 pm
Subject: Re: How to ssh and cd to the current directory?
On Oct 10, 11:03 am, Peng Yu <pengyu...@gmail.com> wrote:

> ssh by default only goes to the home directory ~. I'm wondering if
> there is a way to supply a directory (that is /home/name/some_dir in
> this case) to it, so that it will go to the directory directly.

> $pwd
> /home/name/some_dir
> $ssh localhost # I want to change the directory to /home/name/some_dir
> after sshed to localhost
> $pwd
> /home/name

I don't think there's anything built in, but you could do something
like this:

# ssh targethost '(cd /targetdir; /bin/bash)'

That should get you a working shell in the target directory, and
terminate your connection when you leave that shell.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dag-Erling Smørgrav  
View profile  
 More options Oct 10 2009, 1:21 pm
Newsgroups: comp.security.ssh
From: Dag-Erling Smørgrav <d...@des.no>
Date: Sat, 10 Oct 2009 19:21:30 +0200
Local: Sat, Oct 10 2009 1:21 pm
Subject: Re: How to ssh and cd to the current directory?

Nico Kadel-Garcia <nka...@gmail.com> writes:
> Peng Yu <pengyu...@gmail.com> writes:
> > ssh by default only goes to the home directory ~. I'm wondering if
> > there is a way to supply a directory (that is /home/name/some_dir in
> > this case) to it, so that it will go to the directory directly.
> I don't think there's anything built in, but you could do something
> like this:

> # ssh targethost '(cd /targetdir; /bin/bash)'

> That should get you a working shell in the target directory, and
> terminate your connection when you leave that shell.

You need to add -t, otherwise your shell will think it's reading a
script from /dev/stdin rather than running an interactive session.  You
won't get a prompt, command-line editing etc., and you won't be able to
run any screen-oriented programs (such as top).

DES
--
Dag-Erling Smørgrav - d...@des.no


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Peng Yu  
View profile  
 More options Oct 10 2009, 1:45 pm
Newsgroups: comp.security.ssh
From: Peng Yu <pengyu...@gmail.com>
Date: Sat, 10 Oct 2009 10:45:22 -0700 (PDT)
Local: Sat, Oct 10 2009 1:45 pm
Subject: Re: How to ssh and cd to the current directory?
On Oct 10, 12:21 pm, Dag-Erling Smørgrav <d...@des.no> wrote:

I tried the following command.

ssh targethost '(cd /targetdir; /bin/bash -t)'

It does not give a prompt. When I type 'top', it prints 'TERM
environment variable not set.' then return to the shell in my local
machine.

Would you please help test if you also see the same thing?

Regards,
Peng


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dag-Erling Smørgrav  
View profile  
 More options Oct 10 2009, 2:00 pm
Newsgroups: comp.security.ssh
From: Dag-Erling Smørgrav <d...@des.no>
Date: Sat, 10 Oct 2009 20:00:31 +0200
Local: Sat, Oct 10 2009 2:00 pm
Subject: Re: How to ssh and cd to the current directory?

Peng Yu <pengyu...@gmail.com> writes:
> I tried the following command.

> ssh targethost '(cd /targetdir; /bin/bash -t)'

ssh -t targethost 'cd /targetdir; /bin/bash'

DES
--
Dag-Erling Smørgrav - d...@des.no


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Unruh  
View profile  
 More options Oct 10 2009, 6:17 pm
Newsgroups: comp.security.ssh
From: Unruh <unruh-s...@physics.ubc.ca>
Date: Sat, 10 Oct 2009 22:17:33 GMT
Local: Sat, Oct 10 2009 6:17 pm
Subject: Re: How to ssh and cd to the current directory?

Uh, -t is the argument to ssh, not to bash.
ssh -t target 'cd /targetdir; /bin/bash '
for example.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »