【问题标题】:ssh: User not allowed shell does not exist [closed]ssh:用户不允许的外壳不存在[关闭]
【发布时间】:2013-09-24 15:56:55
【问题描述】:
  • 阿帕奇
  • CentosOS 5
  • Plesk 10

命令行和 ssh 的新功能。

在尝试让多个用户(root git 朋友)ssh 到同一个 shell 并配置无密码连接时,我一定犯了一个错误。

我可以不再以 root 或 git 身份通过 ssh 登录,但可以作为我通过编辑 etc/passwd 转移其 shell 的朋友。 幸运的是,我仍然可以在 plesk 上登录,因此可以进行 gui 文件编辑。

这是我在 sshd 错误日志中发现的内容

sshd[11999]: User git not allowed because shell /bin/bash\r does not exist
sshd[12000]: input_userauth_request: invalid user git
sshd[11999]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=xxx.xxx.xxx.dynamic.upc.nl  user=git
sshd[11999]: Failed password for invalid user git from xxx.xxx.xxx port 54851 ssh2

我读了一些关于 sudo 并顺便输入的内容:导致 \r 但是在哪里恢复呢? 下面是一些配置

等/ssh/sshd_config:

PubkeyAuthentication yes

ect/shells

/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/false
/usr/local/psa/bin/chrootsh
/bin/rbash

等/密码

git:x:10009:10009::/home/git:/bin/bash
friend:x:10010:10010::/home/git:/bin/bash

之前我尝试安装无密码连接 所以在服务器和我的本地机器上的某处有一个 .ssh/id_rsa 文件。

看完Git's famous "ERROR: Permission to .git denied to user"

我试过了

ssh-add -l
Could not open a connection to your authentication agent

我的问题类似于: https://serverfault.com/questions/480806/ssh-root-access-denied-after-changing-shell

如果我以好友身份通过 ssh 登录,我将无法使用 sudo 登录:

sudo root 
friend is not in the sudoers file

我也不能chsh

[friend@vpsXXX ~]$ chsh -s /bin/bash root
chsh: Running UID doesn't match UID of user we're altering, shell change denied

希望有人能帮我解决这个问题。

如果需要,很乐意提供更多信息

【问题讨论】:

    标签: linux git shell ssh


    【解决方案1】:
    /bin/bash\r
    

    表示您已使用 Windows 编辑器编辑了 /etc/passwd 或 /etc/shell,因为它包含 Windows 换行符 \r\n。 Linux 仅解释 \n 并假定剩余的 \r 是二进制名称的一部分。

    解决方案:在 Linux 编辑器中打开文件并删除新行并重新添加。

    您也可以安装包tofrodos 并执行:

    fromdos /etc/passwd
    fromdos /etc/shells
    

    【讨论】:

    • 正确,我是在Plesk中做的,现在我尝试快速学习vi,首先将权限更改为朋友
    • vim 是编辑 IMO 文件的最佳选择 :) 如果您需要更简单的开始,您可以使用 nano 甚至 mc
    • 奇怪我试图删除换行符,但没有。 :wq 但还是同样的错误:/bin/bash\r
    • 嗯 :wq 对于保存 :x 是不正确的,所以我在手册中阅读了。现在使用 vim。但仍然是同样的错误。即使在每个 bin/bash 行上退格并再次输入。
    • 你试过fromdos 吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-07
    • 2021-10-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-02
    相关资源
    最近更新 更多