ssh: User not allowed shell does not exist

  • Apache
  • CentosOS 5
  • Plesk 10

New on commandline and ssh.

While trying to get several users (root git friend) to ssh to the same shell and configuring passwordless connection I must have made a mistake.

I can no longer login over ssh as root or git but can as friend whose shell I transferred by editting etc/passwd.
I luckily can still login on plesk so gui file editing is possible.

here’s what I found in my sshd errorlog

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

I read something about sudo ing and incidently entering: causing the \r
But where to restore?
Here are some configurations

etc/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

etc/passwd

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

earlier I tried to install password less connecting
so there is a .ssh/id_rsa file somewhere on the server and on my local machine.

After reading Git's famous "ERROR: Permission to .git denied to user"

I tried

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

My problem resembles this:
https://serverfault.com/questions/480806/ssh-root-access-denied-after-changing-shell

If I am logged over ssh as friend I cannot sudo to root:

sudo root 
friend is not in the sudoers file

nor can I chsh

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

Hope someone can clear this up for me.

Happy to supply more info if needed

  • Jenkins CLI Authentication
  • Is it possible to setup Gerrit for GIT without using per person SSH certificates
  • How to configure git in ec2 with my local machine?
  • Creating a git repo on a remote server from a local machine
  • Using git without X11 forwarding
  • Github “permission denied (public key)” despite public key being added and keys regenerated
  • Cannot push to Heroku because key fingerprint
  • key_load_public: No such file or directory even though file exists
  • One Solution collect form web for “ssh: User not allowed shell does not exist”

    /bin/bash\r
    

    means that you’ve edited the /etc/passwd or /etc/shells with a Windows editor as it contains Windows line feeds \r\n. Linux interprets only the \n and assumes that the remaining \r is part of the binary name.

    Solution: Open the files in a Linux editor and remove the new line and add it again.

    Also you could install the package tofrodos and execute:

    fromdos /etc/passwd
    fromdos /etc/shells
    
    Git Baby is a git and github fan, let's start git clone.