一、安装 ssh server
输入sudo apt get install openssh server
二、切换到window下登录发现出错
按照大多数的解决方法,在/etc/ssh/sshd_config文件末尾,添加
Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc
MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org
添加完成后,重启ssh服务(/etc/init.d/ssh restart),出现问题
Restarting ssh (via systemctl): ssh.serviceJob for ssh.service failed because the control process exited with error code.
See “systemctl status ssh.service” and “journalctl -xe” for details.
failed!
通过查找资料分析,应该是不同版本,使用的内容不一样,
通过使用ssh -Q cipher/ssh -Q macs/ssh -Q KexAlgorithms读取使用版本的选项
将上面添加到/etc/ssh/sshd_config文件末尾的内容进行修改,将cipher/macs/KexAlgorithms后的内容替换成查询的内容。
最后添加到/etc/ssh/sshd_config文件末尾的内容为
Ciphers 3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
Macs hmac-sha1,hmac-sha1-96,hmac-sha2-256,hmac-sha2-512,hmac-md5,hmac-md5-96,umac-64@openssh.com,umac-128@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,curve25519-sha256,curve25519-sha256@libssh.org,sntrup4591761x25519-sha512@tinyssh.org
重启ssh服务(/etc/init.d/ssh restart)
成功
三、传输文件验证
回到windows下,使用SSH Secure输入IP地址(在终端模式下使用ifconfig)、用户名 、port(默认22),验证模式为Password,
登录成功,并能传输文件