Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run python script in remote machine opened through putty

Tags:

python

ssh

putty

I have a python program which I run in the python shell. Now I open putty with a host name through ssh connection. I login with username and password. Now my problem is that my python program has to run in this remote server that I have opened through putty. The output files that this python program generates has to be stored in the remote server only. Should I copy my python script to the remote server and install python in the remote server to run my script? Or is there any other way this can be done? How to install specific python modules in the remote server?

like image 728
Anusha R Avatar asked Jan 26 '26 21:01

Anusha R


1 Answers

Yes, you have to copy your python script to the remote server.

Here is a link on how to copy files to a remote server using putty.

If you are connecting through putty then your server should be (I think so) Unix/Linux. Exe files won't work there, but the Python should be installed by default.

Type in the shell (command prompt) uname -a or more /etc/issue to learn what Unix/Linux there is on the remote server.

Navigate to the folder where you copied python script cd /my/directory/

Launch the script python yourscript.py

like image 200
MartinsM Avatar answered Jan 28 '26 12:01

MartinsM