如何使用SSH远程访问服务器?

如何使用SSH远程访问服务器?,ssh,deployment,server,remote-access,Ssh,Deployment,Server,Remote Access,我正在尝试使用SSH命令远程访问服务器终端。但我面临着错误。 我已创建了我的“.ppk”文件,并尝试执行以下操作: ssh-i MYFILE.ppk用户_NAME@192.188.28.109-v-p 21098 我输入了正确的密码、用户名、IP地址和端口。我可以使用putty连接,但不能使用terminal/CMD。 请建议 我得到这个错误: OpenSSH_7.9p1, LibreSSL 2.7.3 debug1: Reading configuration data /etc/ssh/ss

我正在尝试使用SSH命令远程访问服务器终端。但我面临着错误。 我已创建了我的“.ppk”文件,并尝试执行以下操作:

ssh-i MYFILE.ppk用户_NAME@192.188.28.109-v-p 21098

我输入了正确的密码、用户名、IP地址和端口。我可以使用putty连接,但不能使用terminal/CMD。 请建议

我得到这个错误:

OpenSSH_7.9p1, LibreSSL 2.7.3
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to 198.187.29.149 [198.187.29.149] port 21098.
debug1: Connection established.
debug1: identity file MYFILE.ppk type -1
debug1: identity file MYFILE.ppk-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000002
debug1: Authenticating to 198.187.29.149:21098 as 'USER_NAME'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: kex: client->server cipher: aes128-ctr MAC: hmac-sha2-256 compression: none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(2048<8192<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:LQPAAsZ1vHcK//jXTbyUFWmqQ3FEEpKgb8FV6jbjoZE
debug1: Host '[198.187.29.149]:21098' is known and matches the RSA host key.
debug1: Found key in /Users/utkarsh/.ssh/known_hosts:1
debug1: rekey after 4294967296 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 4294967296 blocks
debug1: Will attempt key: MYFILE.ppk  explicit
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: MYFILE.ppk
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for 'MYFILE.ppk' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "MYFILE.ppk": bad permissions
debug1: Next authentication method: password
MYFILE@198.187.29.149's password: 
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.```
OpenSSH_7.9p1,LibreSSL 2.7.3 debug1:读取配置数据/etc/ssh/ssh\u config debug1:/etc/ssh/ssh_config第48行:应用* debug1:连接到198.187.29.149[198.187.29.149]端口21098。 debug1:已建立连接。 debug1:标识文件MYFILE.ppk类型-1 debug1:标识文件MYFILE.ppk-cert类型-1 debug1:本地版本字符串SSH-2.0-OpenSSH_7.9 debug1:远程协议版本2.0,远程软件版本OpenSSH_5.3 debug1:匹配:OpenSSH_5.3 pat OpenSSH_5*compat 0x0C00002 debug1:将198.187.29.149:21098验证为“用户名” debug1:SSH2\u MSG\u KEXINIT已发送 debug1:SSH2\u MSG\u KEXINIT已收到 debug1:kex:算法:diffie-hellman-group-exchange-sha256 debug1:kex:主机密钥算法:ssh-rsa debug1:kex:server->client cipher:aes128 ctr MAC:hmac-sha2-256压缩:无 debug1:kex:client->server cipher:aes128 ctr MAC:hmac-sha2-256压缩:无
debug1:SSH2\u MSG\u KEX\u DH\u GEX\u请求(2048您得到的错误
警告:未受保护的私钥文件!
因为私钥文件由于安全原因应该是只读文件。使用命令
chmod 400 MYFILE.ppk
分配400权限,然后重试它应该工作的相同命令

此外,使用
ssh
连接的推荐方法是获取
.pem
文件(如果您没有
.pem
文件,请转换
.ppk

请按照以下说明使用
ssh
进行连接

  • .ppk
    文件转换为
    .pem
  • 使用命令
    chmod 400 my_file.pem将权限更改为只读
  • 使用命令ssh-i MYFILE.ppk USER连接远程服务器_NAME@192.188.28.109-v-p 21098

  • 希望您的疑问得到解决。

    看看这里:。行“权限0777…太开放了。”意味着私钥文件的权限允许其他用户读取它,因此ssh拒绝使用它。谢谢,我将我的ppk转换为pem,并且它已经工作。非常感谢