AWS EC2无法访问“ / bin / bash:权限被拒绝”

时间:2018-10-26 05:34:24

标签: amazon-web-services amazon-ec2 ssh centos

我已按照此处的教程缩小EBS的大小:Shrinking CentOS 7 EBS boot volume on AWS

一切正常,但是当我将较小的卷连接到实例时,它通过了运行状况检查,但是我无法通过SSH进入服务器。我收到错误消息:

/bin/bash: Permission denied
Connection to xxxx.compute-1.amazonaws.com closed.

我拍摄了一个实例屏幕快照(AWS上的Centos 7),它仅显示:

ip-xxx-xx-xx-xxx login:

我检查了ssh xxx -v。这是我发现的。您可以看到认证很好,但这似乎是一些权限问题。

OpenSSH_7.7p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/hbin/.ssh/config
debug1: /Users/xxx/.ssh/config line 51: Applying options for testoc
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 48: Applying options for *
debug1: Connecting to xxxxxxxxx.compute-1.amazonaws.com port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/xxx/.ssh/bin.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/xxx/.ssh/bin.pem-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_7.7
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.4
debug1: match: OpenSSH_7.4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to xxxxx.compute-1.amazonaws.com:22 as 'centos'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:uH7uGEBzA8Xb7spU09lMX+YwHeIOzUNgau73aWVMuJQ
debug1: Host 'xxxxx.compute-1.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /Users/xxx/.ssh/known_hosts:61
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/xxx/.ssh/bin.pem
debug1: Authentication succeeded (publickey).
Authenticated to xxxxxx.compute-1.amazonaws.com ([xx.xxx.xx.xxx]:22).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: pledge: network
debug1: client_input_global_request: rtype hostkeys-00@openssh.com want_reply 0
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype eow@openssh.com reply 0
Last login: Fri Oct 26 05:22:27 2018 from xx.xxx.xxx.xxx
/bin/bash: Permission denied
debug1: channel 0: free: client-session, nchannels 1
Connection to xxxxxxx.compute-1.amazonaws.com closed.
Transferred: sent 2688, received 2520 bytes, in 0.3 seconds
Bytes per second: sent 8139.0, received 7630.3
debug1: Exit status 1

已编辑: 这是我在/ var / log / messages

中找到的
audit event#012node=ip-xxx-xx-xx-xxx.ec2.internal type=AVC msg=audit(1540551433.206:1290): avc:  denied  { dyntransition } for  pid=2525 comm="sshd" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:system_r:sshd_net_t:s0 tclass=process#012#012node=ip-172-31-94-158.ec2.internal type=SYSCALL msg=audit(1540551433.206:1290): arch=c000003e syscall=1 success=no exit=-13 a0=6 a1=56221eba6780 a2=20 a3=7ffcffca72a0 items=0 ppid=2524 pid=2525 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="sshd" exe="/usr/sbin/sshd" subj=system_u:system_r:kernel_t:s0 key=(null)

0 个答案:

没有答案