/usr/bin/env: ruby: No such file or directory at S

2019-07-12 20:10发布

问题:

I'm trying to run a ruby script from inside of a bash script at SSH login. I did put the ForceCommand /etc/ssh/MyScript.sh && $SSH_ORIGINAL_COMMAND inside sshd_config and inside MyScript.sh

#!/bin/bash   
./MyRubyScript.rb

In my MyRubyScript.rb

#!/usr/bin/env ruby
#Some Ruby logic
puts 'Hey'

I wanted that MyRubyScript.rb to execute at the event that any one tries to login through SSH. But whenever I try to SSH login into the server, I get the following error.

/usr/bin/env: ruby: No such file or directory

Please help me out!

P.S. I tried to put the Ruby file directly into the sshd_config but it's still the same.