You are not logged in.

#1 2013-12-25 02:33:04

zidarsk8
Member
Registered: 2011-12-06
Posts: 97

[solved] ssh will only login to /bin/bash

I have a machine with a few users and an ssh server.
I would like to setup a user with rbash or nologin for the shell but if i do that, I can't ssh onto that user.

my /etc/passwd

zidar:x:1000:100:zidar:/home/zidar:/bin/bash
smotko:x:1001:1001::/home/smotko:/bin/rbash

now

ssh zidar@pc
su smotko #this works

# but this doesnt
ssh smotko@pc # works only if i change the passwd file back to /bin/bash

this is with my log for ssh with rbash
Dec 25 03:17:25 arch-dev sshd[636]: Failed password for smotko from 10.0.2.2 port 49075 ssh2


and same with bash
Dec 25 03:20:18 arch-dev sshd[678]: Accepted password for smotko from 10.0.2.2 port 49088 ssh2


and this is how ssh looks with anything other than /bin/bash in /etc/passwd
$ ssh smotko
smotko@pc's password:
Permission denied, please try again.

password is correct because i can use it locally

thank you for helping

Last edited by zidarsk8 (2014-03-14 14:59:17)

Offline

#2 2013-12-26 21:57:52

dd
Member
Registered: 2013-12-25
Posts: 1

Re: [solved] ssh will only login to /bin/bash

Are these shells listed in the /etc/shells file? I think openssh reads that and will only allow logins for shells that are listed there.

Offline

#3 2013-12-26 22:03:25

Yaro
Member
Registered: 2009-04-03
Posts: 154

Re: [solved] ssh will only login to /bin/bash

It is easier to log in to those users, then use the chsh command to change their shell. chsh automatically presents the "valid" shells on your system.

Offline

#4 2013-12-26 22:19:53

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [solved] ssh will only login to /bin/bash

The Arch bash package doesn't actually have the /usr/bin/rbash command.  So not only is this not included in the /etc/shells file, but you are also trying to set the shell to something that doesn't actually exist.  See the RESTRICTED SHELL section of the bash man page. 

I think wat you are after might be achieveable by simply using 'set' in the given user's startup files.

Offline

#5 2014-03-14 14:58:59

zidarsk8
Member
Registered: 2011-12-06
Posts: 97

Re: [solved] ssh will only login to /bin/bash

thanks guys. In ubuntu you don't have to edit anything, and I didn't know about the /etc/shells, but putting rbash and false there seems to do the trick.

Offline

Board footer

Powered by FluxBB