[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Libssh (C++ wrapper): connecting to rbash


Hello,
It's me again :)

It seems I found why I have these issues.

I think there might be a bug in libssh.


Here is the /etc/passwd file of my remoteMachine:
root:x:0:0:root:/root:/bin/bash
valid:x:0:0::/home/valid:/bin/rbash

Now, it appears that when I connect to the remote machine via ssh on both
accounts, I get different results:
ssh root@remoteMachine
[...]
# whoami
root
# pwd
/root

ssh valid@remoteMachine
[...]
> whoami
<command not found>
> pwd
<command not found>
(we disabled these commands with rbash).

Now, the issue appears when I attempt to connect (same code as attached
before) via libssh:
Connecting as valid@remoteMachine:
whoami returns root
pwd returns /home/admin
ps -ef | grep tatatata returns rbash -c ps -ef | grep tatatata
I didn't expect this, and I would be happier if whoami returned valid
(or<command not found>
).

Could this be a bug?

All best,
Pascal

[PS: I also opened this on StackOverflow in case someone else checks what's
going on with a similar issue):
http://stackoverflow.com/questions/17048189/libssh-vs-alternative-root-users]


On 11 June 2013 12:40, Pascal Bertrand <floppyzedolfin@xxxxxxxxx> wrote:

> Hello,
> I'm trying to use libssh 5.0 to connect to an account on a machine.
>
> When running "ps -ef  | grep ps " I get:
> rbash -c ps -ef | grep ps
> which corresponds to the command I'm running.
>
> So I'm on a rbash shell, with no other option given to rbash (especially,
> no --noprofile).
>
> When checking the ~/.profile file (which should be loaded - per man
> rbash), it contains
> PATH=/home/my_usr/bin
>
> However, when executing "echo $PATH" I get this:
> PATH=/usr/bin:/usr/local/bin:[etc]
>
> Does anyone know why the ~/.profile file wasn't loaded?
>
> Attached file: the wrapper around the C++ libssh.hpp file that I'm using.
> The command to execute the remote command is line 58.
>
>
> Thanks,
> Pascal
>

References:
Libssh (C++ wrapper): connecting to rbashPascal Bertrand <floppyzedolfin@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org