由于主目录权限更改,无法通过 SSH 登录 Ubuntu 服务器



我有一个远程无头Ubuntu 14.04 VPS(Linode),我从过去3年开始一直在使用它,从我的本地终端SSHing没有任何问题。突然今天当我尝试SSH时,我收到了以下警告,并且在从公钥回退后,我被要求输入密码。输入密码后,我立即注销并出现以下错误:

~> ssh <user>@<server>.com -p 2292
<user>@<server>.com's password: 
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 4.4.0-x86_64-linode63 x86_64)
 * Documentation:  https://help.ubuntu.com/
0 packages can be updated.
0 updates are security updates.
Last login: Fri Feb 19 17:51:39 2016 from 10.49.20.22
Could not chdir to home directory /home/<user>: Permission denied
/bin/bash: Permission denied
Connection to <server>.com closed.

在启用公钥登录之前,出于安全目的,我已经禁用了root登录,并且除了root之外,服务器上只有一个用户,由于某些权限问题,现在无法登录,意外导致没有我做。

请建议在这里可以做些什么来再次获得访问权限?

这是 SSH 的详细输出

~> ssh -v x@cb.com -p 2359
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to cb.com [66.228.60.78] port 2359.
debug1: Connection established.
debug1: identity file /Users/st/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/st/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/st/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/st/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/st/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/st/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/st/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/st/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to cb.com:2256 as 'x'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client chacha20-poly1305@openssh.com <implicit> none
debug1: kex: client->server chacha20-poly1305@openssh.com <implicit> none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:C4FE2EmPxxAYBue706iHjHJwYxsFgwr+b8J/KSK6Y0g
debug1: Host '[cb.com]:2256' is known and matches the RSA host key.
debug1: Found key in /Users/st/.ssh/known_hosts:1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/st/.ssh/bitbucket
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: /Users/st/.ssh/linode
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: /Users/st/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/st/.ssh/id_dsa
debug1: Trying private key: /Users/st/.ssh/id_ecdsa
debug1: Trying private key: /Users/st/.ssh/id_ed25519
debug1: Next authentication method: password
x@cb.com's password: 
debug1: Authentication succeeded (password).
Authenticated to cb.com ([66.228.60.78]:2256).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LC_CTYPE = UTF-8
Welcome to Ubuntu 14.04.4 LTS (GNU/Linux 4.4.0-x86_64-linode63 x86_64)
 * Documentation:  https://help.ubuntu.com/
0 packages can be updated.
0 updates are security updates.
Last login: Fri Feb 19 18:18:23 2016 from 103.249.240.242
Could not chdir to home directory /home/x: Permission denied
/bin/bash: Permission denied
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
debug1: channel 0: free: client-session, nchannels 1
Connection to cb.com closed.
Transferred: sent 4160, received 3064 bytes, in 0.5 seconds
Bytes per second: sent 7925.5, received 5837.4
debug1: Exit status 1

我认为最好和最快的方法 - 是通过 ip-kvm 或网络控制台登录并直接登录,然后检查所有内容。

最新更新