Linux开启ssh,原文链接࿱


Linux开启ssh
1.Ubuntu开启ssh服务及允许root登录

安装ssh服务器端

Ubuntu默认没有安装ssh的server,需要安装

apt-get install openssh-server

1

ssh客户端是默认安装的,安装包:openssh-client,apt安装

允许远程使用root账号ssh登入

修改/etc/ssh/sshd_config文件,修改如下:

#PermitRootLogin prohibit-password
PermitRootLogin yes

1
2

需要重启系统或者sshd服务

1.sudo /etc/init.d/ssh stop
2.sudo /etc/init.d/ssh start
3.sudo service ssh start

1
2
3

安装ssh服务后,系统默认开启系统sshd,查看sshd状态如果不是默认启动,修改服务为enable

sudo systemctl enable ssh

1

2.CentOS开启SSH服务

1.安装openssh-server

yum list installed |grep openssh-server

1

如果有输出,证明已经安装了openssh-server,如果没有,需要安装

yum install openssh-server

1

2.修改sshd服务配置文件

编辑sshd服务配置文件

vi /etc/ssh/sshd_config

1

开启监听端口

Port 22
ListenAddress 0.0.0.0
ListenAddress ::

1
2
3

允许远程登录

PermitRootLogin yes

1

使用用户名密码作为验证连接

PasswordAuthentication yes

1

开启sshd服务

service sshd start

1

配置开机自启动

systemctl enable sshd

————————————————
版权声明:本文为CSDN博主「Tame_complexity」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/crayon0/article/details/122272001

相关内容