Running php script via ssh tunnel in linux box

Now I successfully run php script in local linux.us server. I own another linux.de server that does not have apache / php services. Can I use the 2nd box as an ssh tunnel or proxy server or port bounce or something so that I can hide my ip from the 1st box and how? I already have pbnc installed in the second field, but I donโ€™t know if this can achieve this? I already know how I can do this with windows and putty, but how is this possible with a linux terminal. Sorry for my bad english and thank you very much!

+4
source share
1 answer

If I understand, do you want to execute one script that is on another server via ssh? Right? If this is the case, you need to log in to server number two without a password. It is easy.

First way : All you have to do is generate ssh keys (no password). Here is how you can do it . Second method (better): I assume that you do not have permission to execute the script on server number two. This is easy to solve if you have access to a second server. Here's how you do it:

  • Enter visudo
  • Add this line to the end of the file.

apache ALL = (user) NOPASSWD: script_path

Example

apache ALL=(clamav) NOPASSWD: /usr/bin/clamscan 

In parentheses you enter a user who has permission to execute your script. srcipt_path is in the above example / usr / bin / clamscan.

  • With a twist from the server, you open some file on the server two (lts call it script.php)
  • Modify script.php and add

$ do = exec ("some_script some_arguments")

and thatโ€™s it.

+1
source

Source: https://habr.com/ru/post/1447383/


All Articles