Windows使用SSH远程登录Linux 您所在的位置:网站首页 Windows远程连接Linux Windows使用SSH远程登录Linux

Windows使用SSH远程登录Linux

2023-06-14 07:24| 来源: 网络整理| 查看: 265

Windows使用SSH远程登录Linux

Windows可以使用SSH协议远程登录Linux,有两种方式:

使用账号和密码登录,这样每次登录都需要使用密码。使用SSH密钥登录,每次登录不需要输入密码,方便快捷。

ssh远程登录基本命令:

ssh [email protected] #默认端口号为22 ssh -p port [email protected] #带端口号 使用密码登录

在Linux上修该ssh配置文件:

vim /etc/ssh/sshd_config PasswordAuthentication yes #允许使用密码登录

重新启动ssh服务:

systemctl start sshd.service systemctl enable sshd.service 使用SSH密钥登录

首先在Windows系统中C盘/用户/用户名/.ssh目录下查看是否有id_rsa、id_rsa.pub两个文件。如果没有,可以使用命令行生成ssh密钥对:

ssh-keygen -t rsa -C "[email protected]"

在Linux上修改ssh配置文件:

vim /etc/ssh/sshd_config PubkeyAuthentication yes #启用公钥私钥配对认证方式 AuthorizedKeysFile .ssh/authorized_keys #公钥文件路径 PermitRootLogin yes #允许root使用ssh登录

将Windows中id_rsa.pub文件中的公钥复制到Linux下~/.ssh/authorized_key文件中保存。

重新启动ssh服务:

systemctl start sshd.service systemctl enable sshd.service


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有