开发者

How to Connect to localhost with SSH(PuTTy)

I just figured how to connect to my webhost with PuTTy .

But how to I connect to my localhost? I put

Servername:开发者_如何转开发 localhost port: 22 (I've tried 80 too)

And it gives me an error "failed to connect"

How do I connect?


If you are using Cygwin on your local host, you can connect to Cygwin's sshd (SSH Daemon).

3 easy commands to install the sshd as a service: (always there when you startup the machine)

$ ssh-host-config -y # enable sshd. "-y" answers yes to all queries.
$ cygrunsrv --start sshd # start it as an autostart Windows service
$ ssh localhost # try to recursively log in via ssh

Taken from: http://nfnaaron.posterous.com/tag/puttycyg#Section2 (The second approach)

=> You get the entire ssh infrastructure: public key authentication, ssh-agent, etc...


Ensure that you have running a SSH server (such as openssh-server) running on localhost and not just a web server (such as apache). Also ensure, that localhost is really mapping to 127.0.0.0/8


The solution in the answer above won't work unless you have installed Cygwin with the OpenSSH package selected - you have to do this manually during the installation process (see option a below).

Depending on the intended purpose of your connection you can try one of the options below, option (b) being much easier to install but lacking the *nix shell capabilities.

a. You can install a Cygwin shell with ssh server, this site (http://ist.uwaterloo.ca/~kscully/CygwinSSHD_W2K3.html) has instructions for Windows Server but they work for other Windows too with may be some of the questions shown in the output on the page not appearing on non-server version of Windows. Also, where it says in the instructions to issue the command:

mount -s --change-cygdrive-prefix /

delete the -s option so that the command is

mount --change-cygdrive-prefix /

(at least this was the case for me on Windows 7).

b. PuTTy site suggests WinSSHD (http://www.bitvise.com/winsshd-download). It's an easy self-installer. Once it's up you have to click onthe StartSSHD link about 1/3rd of the screen down on the first page of the config window. Then you can connect your PuTTy to localhost. However, in my experience, it didn't provide any *nix command support, only the native Windows ones and I couldn't find anything in their user guide on this.

Hope this helps.


Just adding this answer in case anyone is still looking for a solution.

  • In your hostname (or IP address) section, enter localhost or 127.0.0.1
  • Leave the port to its default value 22
  • Click on open

Now a login shell will popup -

  • Log in as your username, your username is basically what you get when you type whoami in your Terminal.
  • In the password section, type the password that you use as your system's password.

The above steps should connect localhost with ssh(PuTTY)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜