解决方案:

1.安装openssh-server

Ubuntu缺省安装了openssh-client,所以在这里就不安装了,如果你的系统没有安装的话,再用sudo apt-get install openssh-server安装上即可。

1.1输入命令:sudo apt-get install openssh-server

 

1.2确认openssh-server是否启动了:
      ps -e |grep ssh

正常情况下结果为:

1584 ?        00:00:00 ssh-agent
2299 ?       00:00:00 sshd

1.3如果只有ssh-agent,则openssh-server还没有启动,需要/etc/init.d/ssh start,如果看到sshd那说明openssh-server已经启动了。

2.ssh-server配置文件位于/etc/ssh/sshd_config,在这里可以定义SSH的服务端口,默认端口是22,你可以自己定义成其他端口号,如222。然后重启SSH服务:

sudo /etc/init.d/ssh restart

 

====================================================

FOR CENTOS:

[root@localhost ~]# ssh 192.168.0.78
ssh: connect to host 192.168.0.78 port 22: Connection refused

[root@localhost ~]# ps -e|grep ssh
...no result

[root@localhost ~]# yum install openssh-server
...install infomation


[root@localhost ~]# service sshd start
Starting sshd:                                             [  OK  ]

[root@localhost ~]# ps -ef|grep ssh
root      19262      1  0 15:32 ?        00:00:00 /usr/sbin/sshd
root      19267  18566  0 15:33 pts/0    00:00:00 grep ssh

====================================================

相关文章:

  • 2021-07-27
  • 2022-01-27
  • 2021-10-31
  • 2021-08-09
  • 2022-12-23
  • 2021-09-29
  • 2021-06-23
  • 2021-08-05
猜你喜欢
  • 2021-12-26
  • 2021-08-08
  • 2022-12-23
  • 2021-12-14
  • 2021-08-25
  • 2021-06-23
  • 2021-09-07
相关资源
相似解决方案