I'm working on an ssh server where the only thing I ever want the user doing is
ssh user@ip cat somefile
Part of my threat mitigation plan was to give the user restricted bash
I've seen examples with chsh rbash
but on my server rbash was not found. So I made a script "rbash"
#!/bin/bash
bash -r
bash -r is an option to launch the restricted shell, so I put this script in /bin. and ran chsh user -s /bin/rbash
Now I can ssh user@ip
into the server and find myself in a restricted shell, but when I try to ssh user@ip cat somefile
the ssh process gets stuck at debug1: sending command: cat somefile
Am I going about this the right way? When I ssh to login in I can cat somefile
, how do I make the command work remotely and keep the restricted shell?
Other possibly relevant info
- Os Fedora 29
- ssh auth method public key