免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1307 | 回复: 2
打印 上一主题 下一主题

在linux与windos之间怎么能不输密码自动ssh [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-06-10 13:57 |只看该作者 |倒序浏览
my colleague install putty ever.but i need to achieve from linux to windows.so that linux is client and windows is server.then copy files from linux to windows.
first iam  come into being a publish keys and private keys with a pair keys in the windows.then i copy publish keys into linux (path is ./ssh below) ,so i use command that's ssh username@IP in the dos,but prompt enter password.

我的同事曾经安装过putty.但是我需要实现从linux ssh到windows.也就是说linux是客户端和windows是服务器,然后从linux 上面可以copy文件到windos上面去,而不要输用户名跟密码
我现在是这样做的:我先在windows上面产生公钥跟私钥一对钥匙.然后我COPY公钥到linux的./ssh这个路径下面,接着我在windows的dos下面用了这个命令:ssh username@IP,但是仍然提示我输密码
我为什么不能不输密码就能ssh到服务器上面,原因在哪?我错在什么地方,有高手能回答本姑娘吗,非常感谢!!!!!!!!
  

论坛徽章:
0
2 [报告]
发表于 2005-06-10 17:19 |只看该作者

在linux与windos之间怎么能不输密码自动ssh

oh,I have the same problem.

I install openssh for windows on my xp machine.I can use password to ssh windows server.but I can't use key to do so. There is a document of this.

  1. OpenSSH for Windows v3.8.1p1-1: Key Authentication
  2. Michael Johnson
  3. youngmug@users.sourceforge.net

  4. Updated 9 July 2004


  5. NOTE: This document is outdated. You can use this as a reference, but please don't expect it to be accurate. I will update this soon.



  6. Notes:
  7. ------
  8. This document does not cover all posibilities of using key authentication, and only covers OpenSSH to OpenSSH key authentication. For setups using commercial SSH or other products, please check the official OpenSSH site at http://www.openssh.com/.

  9. This document assumes that a passwd file has been correctly configured for the user and that the user has been able to successfully log on interactively using a password. Please ensure that these things have been checked before proceeding.

  10. Do not try these steps using the same computer for both the server and client, It will not work. You will need to use seperate computers as client and server.

  11. Please also read the readme file. It will hep you understand the use of Unix-style notation in the examples.


  12. Step 1: Generating a Pair of Keys
  13. ---------------------------------
  14. Key Authentication with SSH uses a unique public/private key pair that you will need to create for the user logging onto the server. The ssh-keygen program is used for creating this key pair. To use the program, simply open a command prompt and type ssh-keygen -t keytype, replacing keytype with dsa, rsa, or rsa1 depending on the type of key pair you want to create. If you receive an error that the command is not recognized, then your path is not set up. In this case, change into the bin subdirectory and run the command from there.

  15. Once you get ssh-keygen to run, it will guide you in the process of creating the key pair. If your passwd is correctly configured, ssh-keygen will want to save the keys in your profile directory.

  16. When the program asks for a passphrase, you can simply press the enter key to leave it blank. IF you enter a passphrase, you will need to enter a passphrase everytime you try to connect, probably the reason you want to use keys. This problem is fixed by using ssh-agent, but it has not been tested under the Windows command prompt. (SECURITY NOTE: Not using a passphrase is dangerous. Anyone who can get the private key that was generated can impersonate that user and log on without having to enter a password. Keep the private key secure.)

  17. When this process is complete, ssh-keygen will attempt to create a key. If you are asked if you want to overwrite existing keys, it is best to cancel. If a key pair already exists, you can use the existing keys.

  18. Either way, the result of this process will be two files in a directory called .ssh in your Windows profile directory. If you chose to create rsa1 keys, you will see files called identity and identity.pub. For dsa keys, you will find id_dsa and id_dsa.pub. For rsa, you will find id_rsa and id_rsa.pub. The files ending in .pub are the public key. The files without an extension are the private key.


  19. Step 2: Putting your Public Key on the Server
  20. ---------------------------------------------
  21. The next step is to put your public key on the server. If you will be connecting to the server in this package, you will need to store the public key in a .ssh subdirectory under your user profile directory. For Unix hosts, connect to the server with ssh as the user. You will need to copy the key to a .ssh directory under the directory you are placed in. If the .ssh directory does not exist on either form of server, you will need to create the directory while you are logged in.

  22. If you are using SCP to copy to a Windows server running this package, copy the public key to /home/username/.ssh/ where username is your logon username. If you are using Windows file sharing or disk, copy the public key to a .ssh directory under your profile directory (usually c:\Documents and Settings\username\).

  23. With either Unix or Windows server, remember the directory path that the key needs to go into. Depending on how much access you have to the server and the OS, you can transfer the .pub key on disk, use NFS or Windows File Sharing, or use SCP. With any method, remember the following points:
  24.   1.  Only copy the public key (it ends in .pub), the private key should never leave the client computer.
  25.   2.  Do not remove the public key from the client computer. You can use it for other servers or as backup if it is removed from the server.


  26. Step 3: Place Key in the Authorized Keys File
  27. ---------------------------------------------
  28. The public key you copied to the server will not work without marking it as an authorized key. You will need to append the key you copied to a file called authorized_keys or authorized_keys2.

  29. If you generated dsa or rsa keys and the server is running a version of OpenSSH older than 3.4, you will need to use authorized_keys2. If you are not sure of the version, you can still use authorized_keys2. If you generated rsa1 keys, use authorized_keys.

  30. For a Unix-style server (Linux, etc). change into the .ssh directory for the user and type cat publickeyname >;>; authorized_keys, replacing publickeyname with the correct name of the public key.

  31. For Windows, use copy /b authorized_keys + publickeyname authorized_keys, replacing publickeyname with the proper key name if authorized_keys exists. If that file does not exist, use copy /b publickeyname authorized_keys.


  32. Step 4: Fix StrictModes (Windows Only)
  33. --------------------------------------
  34. There have been reports of the server not reading the public key on some Windows servers (particularly the OpenSSH server on Windows XP). If you cannot authenticate correctly using keys, try turning StrictModes off in the sshd.conf file under the etc directory and restarting the service. This usually fixes the problem.

  35. The correct settings to keep StrictModes enabled are being investigated.


  36. Step 5:  Using the Keys on Multiple Servers
  37. -------------------------------------------
  38. You can use the key pair you generated on other servers for key-based authentication. You don't need to recreate keys for each server, and you should not as it will break any current authentication that might be set up.


  39. Final Notes:
  40. ------------
  41. These instructions are based on steps I have used with Windows to Windows and Linux to Windows configurations. I do not believe that anything has been left out. If there are any problems with the steps in this document, or there are unclear points please contact me at the e-mail address above so that I can improve on this documentation.
复制代码


But I do as he said,I can't succesed again! After I modified  the file sshd_config,I can't start opensshd! Who can help me?

论坛徽章:
0
3 [报告]
发表于 2005-06-30 11:30 |只看该作者

在linux与windos之间怎么能不输密码自动ssh

我也遇到相同的问题.不管是由windows到Linunix,还是Linunix到windows.它都让我输入密码,望那为大虾路过多帮忙.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP