我可以在 PuTTy 以外的其他东西中使用 SSH 密钥(在 Mac 上)吗? [英] Can I use SSH keys in something other than PuTTy (on Mac)?

查看:38
本文介绍了我可以在 PuTTy 以外的其他东西中使用 SSH 密钥(在 Mac 上)吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Bluehost 只推荐 PuTTy.但是,是否可以在 Mac 中使用 ssh 密钥而无需任何额外的可见程序?

Bluehost only recommends PuTTy. However, is it possible to use ssh keys without any extra, visible programs in Mac?

我想轻而易举地连接到我的服务器,以便我可以在终端中控制我的服务器.

I would like to have a connection to my server to be a breeze, so that I can control my server in Terminal.

推荐答案

当然!在 Unix 和 OS X 上,ssh-keygen 命令将为 SSH 公钥认证生成公钥和私钥.调用此命令的常用方法(在客户端上)是:

Of course! On Unix and OS X, the ssh-keygen command will generate public and private keys for SSH public-key authentication. The usual way to invoke this command (on the client) is:

ssh-keygen -t rsa

这个命令会询问你在哪里放置你的私钥;默认位置是~/.ssh/id_rsa,公钥会放在同名文件中,并添加.pub扩展名(例如:<代码>~/.ssh/id_rsa.pub).该命令还要求您为私钥创建密码(密码短语");您可以像我一样将其留空而不使用密码,但我不建议这样做.

This command will ask you where to place your private key; the default place is ~/.ssh/id_rsa, and the public key will be placed in the file of the same name with a .pub extension added (for example: ~/.ssh/id_rsa.pub). The command also asks you to create a password ("passphrase") for the private key; you can leave it blank for no password as I do, but I don't recommend this practice.

在客户端计算机上拥有公钥和私钥后,您需要让服务器识别该公钥.如果你有服务器的shell访问权限,可以用scp上传公钥文件,然后用ssh在服务器上运行如下命令:

Once you have your public and private keys on the client computer, you need to make your server recognize that public key. If you have shell access to the server, you can upload the public key file with scp, then use ssh to run the following command on the server:

cat id_rsa.pub >> ~/.ssh/authorized_keys 

如果您的托管公司没有为您提供 shell 访问权限(尽管 Bluehost 有),或者此过程不起作用,则它可能会为您提供具有相同功能的 Web 界面.

If your hosting company doesn't give you shell access (though Bluehost does), or this procedure doesn't work, it will likely give you a web interface to the same functionality.

一旦您的服务器设置为识别您的公钥,当客户端上的 ssh 尝试使用您的私钥进行身份验证时,它将允许您无需密码即可访问.您可能仍然需要输入您的私钥的密码,但通常您只需为每个客户端登录会话输入一次.

Once your server is set up to recognize your public key, it will allow you access without a password when ssh on the client tries to use your private key for authentication. You may still have to enter your private key's password, but typically you only need to do this once for each client login session.

这篇关于我可以在 PuTTy 以外的其他东西中使用 SSH 密钥(在 Mac 上)吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆