Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a folder in ~/apps/ and another one in the root /apps/

I want to ssh to them




I got the following error:

Could not resolve hostname

What did I do wrong?

share|improve this question

migrated from Feb 26 '11 at 0:59

This question came from our site for professional and enthusiast programmers.

you found a solution? – dnl Feb 24 '11 at 13:35
@dnl I haven't found out yet, I want to use git to push my local repo to the remote site, but I need to ssh to a path – mko Feb 24 '11 at 15:05
than I suggest you should ask simple the question how to do this :) you might find your answer here: – dnl Feb 24 '11 at 15:10
@dnl thanks that's what I want – mko Feb 24 '11 at 15:34
up vote 12 down vote accepted
ssh user@server -t "cd /some/directory; bash --login"
  • -t keeps up the connection if there is user interaction)
  • the "command" is in quotes
  • bash --login is required to keep up the connection after the cd (see -t)
share|improve this answer
see comments underneath questions for more information – dnl Feb 24 '11 at 15:43

I think you are mixing scp and ssh

For ssh you do not need to specify the destination path. You just log in as and you land into the user's home folder.

share|improve this answer

SSH expects the following syntax:

ssh [other_options] [user@]hostname [command]

so when you typed:


SSH understood that you want to connect to a host named "" with a user "user". Since that host does not exist, you receive the error you quoted.

You will have to break your command into two like this:

(type the password, and wait for ssh to log you in)
cd ~/apps/
share|improve this answer

Edit: You can always ssh as and then just navigate to the desired folder using cd folderName

Ozair Kafray explained it better

share|improve this answer

Below let me to login & go to a directory in one line, on ubuntu:

ssh -t "cd /path/to/your/directory/; `echo $SHELL --login`"

OR just

ssh -t "cd /path/to/your/directory/; bash --login"

Best of luck

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .