in reply to Re: perl & ssh
in thread perl & ssh

Hi Captain Whiplash. OK, thanks, that works fine! Updated the known_hosts file locally and authorized_keys at the other end. Another question: I've now created a web interface where I can click on different buttons and to gather information from remote server and I also should be able to stop/start deamons. I would need to be able to switch to root while running the script on remote machine. At the moment it fails (of course) because the effective user is nobody and I would need to be able to switch users to root. Any ways around this? Or is this too dangerous. Thanks!

Replies are listed 'Best First'.
Re: Re: Re: perl & ssh
by azatoth (Curate) on Aug 16, 2001 at 18:06 UTC
Re: Re: Re: perl & ssh
by echo (Pilgrim) on Aug 16, 2001 at 20:13 UTC
    One common way to trigger an action which need root from a web server or other non priviliged account is to the use of an intermediary file. Have the web server write the required to a file, for example a uniquely named file in /tmp. Have a job run from root's crontab that reads the files and performs required actions.

    You lose the interactivity ("your command failed: $errormsg") but that can only be reached I think by giving root privs to your web server, something you really really don't want to do.