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

a few quick questions.

is the 'remote host' a seperate computer?
do you have a firewall doing any sort of access control?
just incase have you tried redirecting STDERR to STDOUT to see if anything odd comes out?
ummmm set debuging to max and check the logs on both the remote and local host....

sadly that is about all i can think of for now. due to the network at school being all screwed up i cant get any inbound bandwidth (time to download Net::SSH::Perl 7 days till completed) means i cant actually try it out but if an act of God occurs I will try it out and see what I can make of it.


jcpunk
all code is tested, and doesn't work so there :p (varient on common PM sig for my own ammusment)

Replies are listed 'Best First'.
Re: Re: Net::SSH::Perl shell vs web
by mikihasa (Initiate) on Jan 17, 2004 at 23:53 UTC
    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)

      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, 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

        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