首页 > 系统相关 >Linux开启ssh并允许root登录(ubuntu、centos、kalilinux)

Linux开启ssh并允许root登录(ubuntu、centos、kalilinux)

时间:2022-12-29 19:58:28浏览次数:61  
标签:sshd centos openssh server etc kalilinux ssh ubuntu root

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

1)安装ssh服务器端

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

apt-get install openssh-server

ssh客户端是默认安装的,连接其它ssh服务器用的,使用 apt install openssh-client安装

2)允许远程使用root账号ssh连接本机

修改/etc/ssh/sshd_config文件

vim /etc/ssh/sshd_config

修改如下:允许root账户登录

#PermitRootLogin prohibit-password
PermitRootLogin yes

需要重启系统或者sshd服务

sudo /etc/init.d/ssh stop
sudo /etc/init.d/ssh start
sudo service ssh restart

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

sudo systemctl enable ssh

2、CentOS开启SSH服务及允许root登录

1)安装openssh-server

yum list installed |grep openssh-server

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

yum install openssh-server

2)修改sshd服务配置文件

编辑sshd服务配置文件

vim /etc/ssh/sshd_config  #没有vim用vi或者yum install -y vim 安装

开启监听端口

Port 22
ListenAddress 0.0.0.0
ListenAddress ::

允许远程登录

PermitRootLogin yes

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

PasswordAuthentication yes

重启sshd服务

service sshd start
service sshd restart

配置开机自启动

systemctl enable sshd

3、Kalilinux开启ssh及允许root登录

1)安装ssh服务器端

Kalilinux默认是没有安装ssh的

apt-get install openssh-server

2)修改配置让ssh允许root登录

1.配置ssh配置文件

vim /etc/ssh/sshd_config

2.找到配置

原来这行:PermitRootLogin prohibit-password 
修改成这行:PermitRootLogin yes

3.保存退出,重启ssh服务

/etc/init.d/ssh restart

3)添加ssh开机自启动

1.启动ssh

3)添加ssh开机自启动
1.启动ssh

/etc/init.d/ssh start
#或
systemctl  start sshd
1
2
3
2.查看ssh的运行状态

/etc/init.d/ssh status
#或
systemctl  status sshd
1
2
3
3.开机自启动配置

systemctl enable ssh.service
#或
update-rc.d ssh enable
1
2
3
推荐几款shh客户端连接工具

1、MobaXterm_Personal

2、electerm

3、PuTTY

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

  

  

标签:sshd,centos,openssh,server,etc,kalilinux,ssh,ubuntu,root
From: https://www.cnblogs.com/Jeffrey1172417122/p/17013386.html

相关文章

  • CentOS7开启telnet服务端,配合进行ssh升级
    默认情况下,linux’操作系统我们都是通过ssh进行远程操作,开启telnet一般是在升级ssh的时候需要,开启telnet是为了防止升级ssh之后,无法通过ssh登录系统,可用telnet登录。1.......
  • Ubuntu Docker安装
    一步到胃https://blog.csdn.net/qq_44732146/article/details/121207737换源https://zhuanlan.zhihu.com/p/347643668重启systemctlrestartdocker查看配置docker......
  • Ubuntu20.04更换系统默认启动内核
    一、Ubuntu20.04更换系统默认启动内核,【采用apt更新在线内核】参考:https://blog.csdn.net/weixin_46584887/article/details/125973263二、操作步骤首先使用如下命......
  • ubuntu安装docker
    1.先卸载旧版,如果没有的话,就不用执行了,直接第二步。apt-getremovedockerdocker-enginedocker.iocontainerdrunc2.在终端输入aptupdateapt-getinstallca-certifi......
  • 安装virtualbox及ubuntu
    https://www.virtualbox.org/wiki/Downloads https://releases.ubuntu.com/bionic/下载一个iso然后按步骤安装。  最后修改网络模式  如果使用xshell,需要......
  • vm12 安装ubuntu15.10详细图文教程 虚拟机安装ubuntu安装 ubuntu更新软件 ubuntu一直
    vm12安装ubuntu15.10详细图文教程虚拟机安装ubuntu安装ubuntu更新软件ubuntu一直卡在下载语言怎么办官网下载ubuntu下载ubuntu镜像文件虚拟机安装......
  • ubuntu 中 docker 每次都输入 sudo 命令
    查看用户组及成员sudocat/etc/group|grepdocker可以添加docker组sudogroupadddocker添加用户到docker组sudogpasswd-a${USER}docker增加读写权限(这个需要......
  • centos7下docker启动时报iptables错误
    centos7启动docker报错内容:iptablesfailed:iptables--wait-tnat-ADOCKER-ptcp-d0/0--dport22201-jDNAT--to-destination172.18.0.2:22!-idocker0:ip......
  • Centos7重置root密码
    如果忘记root密码,可以按以下步骤进行密码重置第一步在启动页面选择内核版本页面,按e进入编辑模式:  拉到后面,将ro改为rw,在这行后面加上init=/bin/sh    按ct......
  • 虚拟机(centos7)启动后没有ens33 ip地址的解决办法
    虚拟机(centos7)启动后,执行ipaddr命令,显示ens33没有ip地址,无法使用远程连接,这是由于网卡未加入托管所致;临时解决方案:执行命令:dhclientens33执行后查看ipaddr,ens33......