300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > windows 通过cmd窗口ssh命令使用密码远程连接服务器(Ubuntu)

windows 通过cmd窗口ssh命令使用密码远程连接服务器(Ubuntu)

时间:2019-07-12 07:03:45

相关推荐

windows 通过cmd窗口ssh命令使用密码远程连接服务器(Ubuntu)

密码登录

Ubuntu 系统的默认用户名是 ubuntu,并在安装过程中默认不设置 root 帐户和密码。您如有需要,可在设置中开启允许 root 用户登录。具体操作步骤如下:

首先另辟路径登上你的基于Ubuntu的服务器

执行命令,设置root密码sudo passwd root

输入密码,重复输入密码,返回passwd: password updated successfully说明root密码设置成功

打开sshd_config配置文件,路径/etc/ssh/sshd_config,具体的ssd_config解析

找到# Authentication:修改PermitRootLogin yes

# Authentication:#LoginGraceTime 2m#PermitRootLogin prohibit-password# 禁止密码登录,只允许通过密钥登陆PermitRootLogin yes#StrictModes yes#MaxAuthTries 6#MaxSessions 10

修改PasswordAuthentication参数为yes,没有就添加

# To disable tunneled clear text passwords, change to no here!PasswordAuthentication yes#PermitEmptyPasswords no

重启ssh服务,sudo service ssh restart。或者重启服务器,或sudo systemctl restart sshd

然后就可以通过cmd窗口命令

ssh root@公网ip或域名#但是域名得提前解析到公网ip

如果出现以下WARNNING,就把C:\\Users\\andya/.ssh/known_hosts:1下的known_hosts这个文件删掉

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!Someone could be eavesdropping on you right now (man-in-the-middle attack)!It is also possible that a host key has just been changed.The fingerprint for the ECDSA key sent by the remote host isSHA256:W02kdKGXXmOYxdbdWRS4lj6GU0B+wBaL6VjmoiD6t6c.Please contact your system administrator.Add correct host key in C:\\Users\\andya/.ssh/known_hosts to get rid of this message.Offending ECDSA key in C:\\Users\\andya/.ssh/known_hosts:1#这个路径!!!ECDSA host key for yanghe.life has changed and you have requested strict checking.Host key verification failed.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。