Ubuntu Forums Archive Viewer

Run command from http

Archived thread 1005956 from Security. Markdown source: Security/thread_1005956_Run_command_from_http.md

Original URL About this archive
#1

Hi guys,

I have a script that I would like to be able to run remotely.

My phone will only allow me to use http so i cannot ssh into the box.

What i need to do is to be able to remotely run a sript using the http service presented by apache.

First of all how do i get apache to run a command on the box? What sort of http command would i use, i guess something along the lines of php etc..

Secondly i dont wish anyone else to be able to execute this so im thinking .htaccess is a good route, i was also considering restricting access to a range of IP address but my mobile phones IP always changes.

If you need to be able to securely execute a single script stored on the server using http how would you do it?

Cheers in advance

#2

the php exec() function is probably what you look for.

#3

I would be very cautious when doing this. Creating a php script would be easiest. However, a programming mistake may allow users to run ANY command, which would be very bad. Even if you require authentication, it's still a risk. Make sure you use encryption and a strong password.

#4

Hi phillips321,

I think http://www.smetj.net/wiki/Teleporter is exactly what you're looking for.

Cheers,

Jelle

#5

Sorry misunderstood the question.