Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Amazon web services 通过ssh连接而不访问主文件夹_Amazon Web Services_Ssh_Amazon Ec2 - Fatal编程技术网

Amazon web services 通过ssh连接而不访问主文件夹

Amazon web services 通过ssh连接而不访问主文件夹,amazon-web-services,ssh,amazon-ec2,Amazon Web Services,Ssh,Amazon Ec2,我已经在AmazonEC2上安装了一个tomcat,我正试图在/home/ec2user/folder的文件夹中编写这个应用程序。 但是我没有得到,因为tomcat用户拥有该文件夹的权限 我试图更改tomcat用户的所有者,但都没有成功。 我想可能是文件夹/home/ec2 user/出了问题,然后更改到该文件夹的权限。。。但没有起作用 搜索Internet时,我找到了命令setEnforce0,但它不起作用 然后我关闭会话,当我再次尝试登录时收到以下消息 ssh -i "Amazon-Tomc

我已经在AmazonEC2上安装了一个tomcat,我正试图在/home/ec2user/folder的文件夹中编写这个应用程序。 但是我没有得到,因为tomcat用户拥有该文件夹的权限

我试图更改tomcat用户的所有者,但都没有成功。 我想可能是文件夹/home/ec2 user/出了问题,然后更改到该文件夹的权限。。。但没有起作用

搜索Internet时,我找到了命令
setEnforce0
,但它不起作用

然后我关闭会话,当我再次尝试登录时收到以下消息

ssh -i "Amazon-Tomcat.pem" ec2-user@ec2-52-39-23-66.us-west-2.compute.amazonaws.com
Permission denied (publickey).
ssh -i "Amazon-Tomcat.pem" ec2-user@ec2-52-39-23-66.us-west-2.compute.amazonaws.com -v
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ec2-52-39-23-66.us-west-2.compute.amazonaws.com [52.39.23.66] port 22.
debug1: Connection established.
debug1: identity file Amazon-Tomcat.pem type -1
debug1: identity file Amazon-Tomcat.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 21:76:3c:72:dd:68:14:c5:83:a6:09:9a:80:26:74:bc
debug1: Host 'ec2-52-39-23-66.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /home/rodrigo/.ssh/known_hosts:7
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: OpenShift-Key
debug1: Authentications that can continue: publickey
debug1: Trying private key: Amazon-Tomcat.pem
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
我想可能是因为我无法访问/home/ec2 user/然后尝试根目录,但我得到了

ssh -i "Amazon-Tomcat.pem" root@ec2-52-39-23-66.us-west-2.compute.amazonaws.com
Please login as the user "ec2-user" rather than the user "root".

Connection to ec2-52-39-23-66.us-west-2.compute.amazonaws.com closed.
如果在连接中使用-v,则命令将接收以下消息

ssh -i "Amazon-Tomcat.pem" ec2-user@ec2-52-39-23-66.us-west-2.compute.amazonaws.com
Permission denied (publickey).
ssh -i "Amazon-Tomcat.pem" ec2-user@ec2-52-39-23-66.us-west-2.compute.amazonaws.com -v
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ec2-52-39-23-66.us-west-2.compute.amazonaws.com [52.39.23.66] port 22.
debug1: Connection established.
debug1: identity file Amazon-Tomcat.pem type -1
debug1: identity file Amazon-Tomcat.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 21:76:3c:72:dd:68:14:c5:83:a6:09:9a:80:26:74:bc
debug1: Host 'ec2-52-39-23-66.us-west-2.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /home/rodrigo/.ssh/known_hosts:7
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: OpenShift-Key
debug1: Authentications that can continue: publickey
debug1: Trying private key: Amazon-Tomcat.pem
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

非常感谢您提供的任何建议,请原谅我的愚蠢

您错误地将.ssh密钥公钥的权限设置得过于宽松,这意味着ssh登录过程拒绝工作

若要解决此问题,请参阅此问题的得分最高的答案

基本上,您必须将磁盘从现在已损坏的ec2装载到新的ec2上并修复它

要解决原始问题(tomcat写入文件夹),请为/home/ec2用户主文件夹顶层提供“其他x”访问权限

chmod o+x /home/ec2-user
和“全部”访问您的“文件夹”

保持.ssh目录和其他目录不变


下次在您注销之前,测试ssh仍在工作

您错误地将.ssh密钥公钥的权限设置得过于宽松,这意味着ssh登录进程拒绝工作

若要解决此问题,请参阅此问题的得分最高的答案

基本上,您必须将磁盘从现在已损坏的ec2装载到新的ec2上并修复它

要解决原始问题(tomcat写入文件夹),请为/home/ec2用户主文件夹顶层提供“其他x”访问权限

chmod o+x /home/ec2-user
和“全部”访问您的“文件夹”

保持.ssh目录和其他目录不变


下次在您注销之前,测试ssh仍在工作

如果您使用的是Mac或linux/unix风格的机器,请再次运行ssh命令,然后tail-f/var/log/auth.log。最后几行将给出准确的错误消息。尝试将密钥对文件的权限更改为600(运行chmod 600 Amazon Tomcat.pem),然后再次尝试ssh。

如果您使用的是Mac或linux/unix风格的计算机,请再次运行ssh命令,然后使用-f/var/log/auth.log。最后几行将给出准确的错误消息。尝试将密钥对文件的权限更改为600(运行chmod 600 Amazon Tomcat.pem),然后重试ssh。

我假设
Amazon Tomcat.pem
是pem格式的SSL客户端证书。这也是证书的文件名吗?根据ssh手册页,“ssh还将尝试从通过将-cert.pub附加到标识文件名而获得的文件名加载证书信息。”因此,您的文件可能需要命名为
Amazon Tomcat.pem-cert.pub
?(是的,这是一个奇怪的文件名,但我只是在浏览了手册页后猜测。)哦,为什么这个标签是“putty”?问题中没有油灰,
ssh
语法看起来像OpenSSH语法。@AxelBeckert谢谢,但我从amazon下载了该文件。我总是使用这些命令登录。我假设
amazontomcat.pem
是pem格式的SSL客户端证书。这也是证书的文件名吗?根据ssh手册页,“ssh还将尝试从通过将-cert.pub附加到标识文件名而获得的文件名加载证书信息。”因此,您的文件可能需要命名为
Amazon Tomcat.pem-cert.pub
?(是的,这是一个奇怪的文件名,但我只是在浏览了手册页后猜测。)哦,为什么这个标签是“putty”?问题中没有油灰,
ssh
语法看起来像OpenSSH语法。@AxelBeckert谢谢,但我从amazon下载了该文件。我总是使用这些命令登录