Page that checks if a user exists on a remote system

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have two servers: ServerA and ServerB.  One server serves web pages, the 
other serves mail.  I am making a web page on ServerA that will access 
ServerB to find out if a users exists and if not then add that user to 
ServerB with information collected from the web page on ServerA.

I have this in a php file:

        $idResults = `ssh admin@xxxxxxxxxx id bigbob 2>&1`;
        echo "id: (".$idResults.")\r\n"."\r\n";
        if (ereg("no such user", $idResults)) {
                echo 'username is available!';
        }

When I access the page I get:

        Could not create directory '/nonexistent/.ssh'.
        Host key verification failed.

This, of course, is because the script is being run as "www" who has no 
place to put ssl keys.

Could this be solved by having "www" "su" to a user who has remote access 
privileges?  Something like this:

        $idResults = `su admin | ssh admin@xxxxxxxxxx id bigbob 2>&1`;
        echo "id: (".$idResults.")\r\n"."\r\n";
        if (ereg("no such user", $idResults)) {
                echo 'username is available!';
                // function addUserToServerB(vars);
        }

Anyone else doing or done something like this?

Thanks,
--
Jonathan Duncan
http://www.nacnud.com 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux