侧边栏壁纸
博主头像
王小木人

这是很长,很好的一生

  • 累计撰写 141 篇文章
  • 累计创建 43 个标签
  • 累计收到 7 条评论

目 录CONTENT

文章目录

Ubuntu 使用终端命令连接服务器

王小木人
2021-07-28 / 0 评论 / 0 点赞 / 1,436 阅读 / 842 字

Ubuntu系统,不需要Windows系统那样,使用类似xshell的远程工具进行服务器的连接,在终端窗口中输入命令:

ssh root@xxx.xxx.xxx.xxx -p 端口

其中,xxx.xxx.xxx.xxx 服务器公网ip地址;终端会输出如下提示:
Are you sure you want to continue connecting (yes/no)?
输入yes, 回车
root@xxx.xxx.xxx.xxx's password:
输入密码, 回车, 即可连接成功;

连接过程可能会报 ssh: connect to host 183.230.239.15 port 22: Connection refused 的错误,

这是系统默认并没有安装ssh服务,如果通过ssh连接服务器,需要自己手动安装openssh-server。
判断是否安装ssh服务,可以通过如下命令进行:

ps -e|grep ssh

如果只有agent,说明没有安装openssh-server

20210728_1718.png

没有的话通过如下命令安装

sudo apt-get install openssh-server

安装后再通过命令 ps -e|grep ssh 查看,多了sshd 就是我们新安装的

20210728_1719.png

之后再连接就没问题了。

0

评论区