gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 05:00:14 25 4
gpt4 key购买 nike

我有一个远程 headless Ubuntu 14.04 VPS (Linode),自过去 3 年以来我一直在使用它,通过从本地终端进行 SSH 没有任何问题。今天,当我尝试 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 或 Web 控制台登录并直接登录,然后检查所有内容。

关于linux - 由于主目录权限更改而无法通过 SSH 登录 Ubuntu 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35505872/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com