0
  • 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

Community
  • 1
  • 1
Webconstructor
  • 525
  • 2
  • 6
  • 15

1 Answers1

2
/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
hek2mgl
  • 152,036
  • 28
  • 249
  • 266