一、开启ssh服务

  1. 先检查有没有安装ssh服务:rpm -qa | grep ssh
    CentOS7开启ssh服务并使用xshell连接
  2. 如果没有就安装openssh-server:yum install openssh-server
  3. 查看并修改ssh配置:vim /etc/ssh/sshd_config
    CentOS7开启ssh服务并使用xshell连接
  4. 启动ssh服务:/bin/systemctl start sshd.service
  5. 检查ssh服务是否开启:ps -e | grep sshd
    CentOS7开启ssh服务并使用xshell连接
  6. 检查 22端口 是否开启:ps -e | grep 22
    CentOS7开启ssh服务并使用xshell连接
  7. 将ssh服务添加到自启动列表中:systemctl enable sshd.service

二、使用Xshell6连接服务器

创建新的会话
CentOS7开启ssh服务并使用xshell连接
连接即可,自己测试可以使用root用户登陆

相关文章: