win2008下openssh安装配置(sftp服务器)

时间:2021-09-17 13:57:29

安装配置参考安装目录下doc的quickstart.txt或者readme.txt文件。

配置:

--摘自quickstart.txt---------

Configuration
-------------
1.  Open a command prompt and change to the installation directory (Program Files\OpenSSH is the default).

2.  CD into the bin directory.

3.  Use mkgroup to create a group permissions file. For local groups, use the "-l" switch. For domain groups, use the "-d" switch.
    For both domain and local, it is best to run the command twice (remember to use >>, not >). If you use both, make sure to edit the file to remove any duplicate entires.

      mkgroup -l >> ..\etc\group      (local groups)
      mkgroup -d >> ..\etc\group      (domain groups)

4.  Use mkpasswd to add authorized users into the passwd file. For local users, use the "-l" switch. For domain users, use the "-d" switch.
    For both domain and local, it is best to run the command twice (remember to use >>, not >). If you use both, make sure to edit the file to remove any duplicate entires.

      mkpasswd -l [-u <username>] >> ..\etc\passwd      (local users)
      mkpasswd -d [-u <username>] >> ..\etc\passwd      (domain users)

    NOTE: To add users from a domain that is not the primary domain of the machine, add the domain name after the user name.
    NOTE: Ommitting the username switch adds ALL users from the machine or domain, including service accounts and the Guest account.

5.  Start the OpenSSH server.

      net start opensshd

6.  Test the server. Using a seperate machine as the client is best. If you connect but the connection immediately gets dropped, reboot the machine with the server and try connecting again.

 

设置口令验证方式:

  1. 在OpenSSH安装目录下的“etc”目录中,打开“sshd_config”文件。
  2. 去掉“PasswordAuthentication”参数前的“#”符号,并设置“PasswordAuthentication”“yes”

    PasswordAuthentication yes

     

错误:1067进程意外终止

安装完之后"net start opensshd"windows2008会有此错误。

原因: The main problem to this issue is having multiple cygwin1.dll on your computer and have one of them on the PATH variable.

 http://www.techsoar.com/openssh-error-1067the-process-terminated-unexpectedly/

解决:在安装bin目录下会有cygrunsrv.exe程序,此进程为启动opensshd服务的主进程。

cygrunsrv.exe右键属性——》兼容性(标签)——》更改所以用户的设置(下面)——》勾上以兼容模式运行这个程序(选择win2003)——》OK

openssh客户端远程错误

原因:RSA host key has changed

C:\Documents and Settings\【用户名】\.ssh\known_hosts 删除里面远程内容

远程不上服务器新建用户 

新建过用户之后,还需要将用户添加到组。

 更改用户登录目录

详细查看readme.txt中The /home Directory一节

修改注册表中native路径,可以修改/home目录路径,如下:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Cygnus Solutions\Cygwin\mounts v2\/home]
"native"="C:\\Program Files\\OpenSSH\\home"

如果要使用户拥有自己的目录,需要修改etc\passwd。如下icd用户的/home/icd,icd1的/home/icd1目录:

icd:unused_by_nt/2000/xp:1026:513:icd,U-CKF49430A\icd,S-1-5-21-823518204-1303643608-1801674531-1026:/home/icd:/bin/switch
icd1:unused_by_nt/2000/xp:1027:513:icd1,U-CKF49430A\icd1,S-1-5-21-823518204-1303643608-1801674531-1027:/home/icd1:/bin/switch