美文网首页
linux 配置 ssh 远程登陆

linux 配置 ssh 远程登陆

作者: simbanyan | 来源:发表于2020-04-24 08:14 被阅读0次

安装

sudo apt-get install openssh-server

配置

  • 修改 /etc/ssh/sshd_config 文件
vi /etc/ssh/sshd_config 
  • 去掉 第13行的注释,设定端口

  • 去掉32行注释,运行 root 用户可以登录 ,不操作这步也可以,root 用户不可以远程登陆

启动服务

sudo service sshd start 

或者

sudo service ssh start

或者

sudo /etc/init.d/ssh start
  • 备注 有些linux 系统可能没有 sshd , 就用shh代替, 或者 ssh.service
    如果需要 停止, 把 start替换成 stop即可

其他命令

systemctl status ssh  查看服务状态
systemctl enable ssh 开机自动启动服务
systemctl disable ssh 关闭开机自动启动服务

相关文章

网友评论

      本文标题:linux 配置 ssh 远程登陆

      本文链接:https://www.haomeiwen.com/subject/heppqctx.html