I setup restricted bash for a user (scriptsser) on Machine A and created symlinks to the desired commands as below
lrwxrwxrwx. 1 root root 10 Nov 28 08:09 touch -> /bin/touch
lrwxrwxrwx. 1 root root 8 Nov 28 08:09 ssh -> /bin/ssh
lrwxrwxrwx. 1 root root 7 Dec 18 07:44 mv -> /bin/mv
Everything works fine and I am able to use these commands while I am logged in to Machine A with this user (scriptsser)
My problem starts when I try to execute a command from a remote machine; say Machine B.
ssh scriptsser@MachineA -i /home/scriptsser/.ssh/id_rsa "mv /file1 /file2" ;
I get the following error message.
rbash: /bin/rbash: restricted: cannot specify `/' in command names
What am I missing here?
mv /file1 /file2
. For some reasonrbash
is trying to run/bin/rbash
. If it tried to run/bin/echo
then the error would start withrbash: /bin/echo:
. Comparerbash -c '/bin/echo'
andrbash -c '/bin/rbash'
.