in reply to Re: Net::SSH::Perl shell vs web
in thread Net::SSH::Perl shell vs web

wow, thanks for all of the great ideas

yes, i am ssh'ing to a remote computer

both the local (where this script is running on the webserver) and the remote computers are dedicated linux servers (with rackshack) and so i would have total control over any sort of firewall...i don't believe anything is in place -- at least i didn't put anything up

i should try redirecting stderr to stdout again...i had done that originally and found the first problem i had was that the web user didn't have permission to write to the .ssh directory, but i fixed it

i'll check the logs, too

thanks again...i hope i can use this module -- the alternative is telnet but that won't work for all of the remote servers i have to access since it is disabled on some of them (which is the reason i started with this ssh module)

Replies are listed 'Best First'.
Re: Re: Re: Net::SSH::Perl shell vs web
by thor (Priest) on Jan 18, 2004 at 16:25 UTC
    the first problem i had was that the web user didn't have permission to write to the .ssh directory, but i fixed it
    I hope that you are talking about the webuser's .ssh directory and not, say, your .ssh directory. That directory is created with user-only write permissions as a matter of security, not to inconvenience users. Furthermore, I seem to recall ssh checking the permissions of a couple of things (the .ssh directory being one of them) and failing if they are not set to a sufficiently restrictive access level.

    thor

      yes, the web user's .ssh directory didn't exist, and the web user didn't have enough rights to create it, so i got an error like this:
      bash-2.05b$ perl vtadmin.cgi Content-Type: text/html <HTML><HEAD><TITLE>Remote Configure Test</TITLE></HEAD><BODY>creating +ssh connection<br> logging in<br> running command: ls -l<br> mkdir /home/httpd/vhosts/koolaid.com/.ssh: Permission denied at /usr/l +ib/perl5/site_perl/5.8.0/Net/SSH/Perl/Util/Hosts.pm line 50
      so i created the .ssh directory and gave it the appropriate permissions and all was well (at least from the command line) after that point

      i figured i was out of the woods when i found that, but i still get no output from the remote command when i run the script from the web browser

        i gave up and went with telnet instead

        thanks anyway

      yes, when i originally ran the script from the command line as the web user (not root) i got an error like this:
      mkdir /home/httpd/vhosts/yeahman.com/.ssh: Permission denied at /usr/l +ib/perl5/site_perl/5.8.0/Net/SSH/Perl/Util/Hosts.pm line 50
      it was apparently trying to create the .ssh directory in the home directory of the web user...so i had a look at that directory and the permissions were set up incorrectly, so i changed them and the next time i ran the script from the command line it created the .ssh directory fine and i thought i was going to be out of the woods at that point

      however, the script still fails when i run it using the web browser, and so i am scouring the local server's settings to see why exactly that would occur