2

I am messing around and want to have a guest user whose login shell is a restricted one like rbash. Unfortunately there is no rbash executable anywhere on my Slackware installation, so I have to do bash -r instead.

I tried putting this in /etc/passwd as the login shell for the user in question: guest:x:1001:1001::/home/guest:/bin/bash -r but it seems to be trying to find an executable with " -r" at the end of the filename and so doesn't let me log in because it doesn't exist.

Is there any way I can start a restricted shell with an option like this, or do I have to install an rbash binary? This is not ideal as I am on a Raspberry Pi (ARM) and may have to compile a package which is something I am unfamiliar with.

4
  • 1
    I don't think there is an "rbash binary" - it's just a symlink to bash, which uses argv[0] to decide whether to run in restricted mode. At least that's how it appears to work on Debian-based systems. Commented Apr 24, 2021 at 13:08
  • Can symlinks pass options to executables they point to? If so how do you do it?
    – Architect
    Commented Apr 24, 2021 at 13:10
  • Yeah, I can do whatever I like with it.
    – Architect
    Commented Apr 24, 2021 at 13:12
  • Ah, I see. I'll write an answer explaining exactly what I did.
    – Architect
    Commented Apr 24, 2021 at 13:18

1 Answer 1

4

All I had to do was create a symlink at /bin/rbash pointing to /bin/bash, and bash must know that is was invoked from a link called rbash and starts itself in restricted mode.

Thanks for your help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .