Remote SSH server accessing local files [closed] - python

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Is it possible to access local files via remote SSH connection (local files of the connecting client of course, not other clients)?
To be specific, I'm wondering if the app I'm making (which is designed to be used over SSH, i.e. user connects to a remote SSH server and the script (written in Python) is automatically executed) can access local (client's) files. I want to implement an upload system, where user(s) (connected to SSH server, running the script) may be able to upload images, from their local computers, over to other hosting sites (not the SSH server itself, but other sites, like imgur or pomf (the API is irrelevant)). So the remote server would require access to local files to send the file to another remote hosting server and return the link.

You're asking if you can write a program on the server which can access files from the client when someone runs this program through SSH from the client?
If the only program running on the client is SSH, then no. If it was possible, that would be a security bug in SSH.

Related

Python program to grab a file off of Raspberry Pi [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am looking to automate file retrieval from a python program that gets a file from my Raspberry Pi and returns it to my local PC. I have tried SSH, FTP & SCP but can't get any to work and run into connection problems in my Python program. Any one have a quick code snippet. below is the code I think should work but getting an error
From PI: Raspberry PI Zero W
Receiving PC: Windows 10 running a pycharm python program
-IDE: Pycharm
NOTE: Connected to same network, ssh, putty, cmd line SCP, remote desktop work to PI but I can't do the same by just running a python program to get a file.
Filename: testfile.jpg
Pi: Directory. /home/pi/testfile.jpg
Open to any method to retrieve file as long as it can do it automagically?
Ideas?
Thank you!
Code failing with Cryptography deprecation error
Code won't make simple connection - feel its on my local pC?
from paramiko import SSHClient
from scp import SCPClient
ssh = SSHClient()
ssh.Connect(ipadd.re.ss)
CAN'T GET PAST HERE ERROR BELOW
Error: CryptographyDeprecationWarning: encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a
future version. Please use EllipticCurvePublicKey.public_bytes to
obtain both compressed and uncompressed point encoding.
m.add_string(self.Q_C.public_numbers().encode_point())
Have you heard of Paramiko? It's an SSH client for Python.
You could do something like:
client.connect(...)
i, o, e = client.exec_command('cat /home/pi/testfile.jpg')
with open('testfile.jpg', 'wb') as f:
for line in o:
# these are lines in the file.
f.write(line)

Communicate between two python scripts on two systems over wifi [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am running a python code on a wipy board (micropython environment) and a python code on an embedded linux system. The wipy board is connected to the linux system with wifi. I was wondering how to create bi-directional communication for passing data between the two independent scripts
I have looked into both threading and multiprocessing but I do not know if either would be appropriate for this use so I am just looking for a conceptual answer so I can find someplace to start
Threading and multiprocessing has nothing to do with your problem. Threading and multiprocessing is all about running multiple programs or part of programs on the same system.
What you want is to use the network to send/receive messages. Please read the
WiPy documentation:
About your WIFI connections
About TCP sockets
The part about the TCP sockets should be exactly what you need. The part about WIFI connections will tell you how to adjust the WIFI settings of your board.
The same goes for your embedded Linux system. Look for documentation on your system and check for the chapter about sockets. I would open a server on one of these devices (or both) and use the other devices to connect to the server and get the information the system needs. It might be a good idea to use the device with more resources as the server.

How to connect to a remote kernel in a ipynb file? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'd like to know how to use a remote AWS instance as the backend for my ipython notebook that I have running locally. I typically use nteract as the frontend for my jupyter notebook.
Motivation: is that my macbook doesn't have an Nvidia GPU, so I'd like the computations done on my P2 instance remotely, but with the notebook running locally.
This is my first question, so please be gentle :)
Typically you ssh to an AWS instance using something like
$ ssh -i key.pem username#ec2-198-51-100-1.compute-1.amazonaws.com
You can local forward to a port, say 8888, with
$ ssh -i key.pem -L 127.0.0.1:8888:127.0.0.1:8888 username#ec2-198-51-100-1.compute-1.amazonaws.com
This will forward anything running on localhost at port 8888 on your AWS instance, to localhost 8888 on your MacBook.
Then on your AWS instance, launch an ipython notebook
$ jupyter notebook --no-browser --port 8888
and then on your MacBook, open a browser and navigate to localhost:8888 and you'll be using the notebook from your AWS instance (which has GPU support).
Hope this helps.

Run web server locally without exposing it publicly? [duplicate]

This question already has answers here:
How do you configure tomcat to bind to a single ip address (localhost) instead of all addresses?
(3 answers)
Closed 8 years ago.
I am running a dedicated server on Digital Ocean. My site uses Flask on NGINX through Gunicorn. During development I plopped a search engine (solr) on a local VM (through VMWare Fusion) which happens to be running Tomcat. It could have been running any web server per my question. In my app I make all search requests to that local ip: 192.168.1.5. Now, when I install Tomcat on my server and run it you can see it publicly at mysite.com:8080. There's the old welcome screen of Tomcat for the world to see. I want my app to be able to access it locally through localhost:8080 but not show it to the world. Is this possible?
The short answer is no.
While using a hosting plan, so actually anything that you are doing is 'exposed to the world' since you yourself have to access it remotely, like everyone else.
You have two options, the first, configure the Digital Ocean server to only accept connections from your public IP, and the second, keep using your development server locally until you are ready for primetime.

How to FTP into a virtual machine? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I've recently started learning Django and have set up a virtual machine running a Django server on VirtualEnv. I can use the runserver command to run the basic Django installation server and view it on another computer with the local IP address.
However, I can't figure out how to connect to my virtual machine with my FTP client so that I can edit files on my host machine (Windows). I've tried using the IP address of the virtual machine with an FTP client but it says "Connection refused by server".
Any help would be appreciated, thanks!
The reason that the the client reported back "Connection refused by server" is that the server returned a TCP packet with the reset bit set, in response to an application trying to connect to a port that is not being listened on by an application, or by a firewall.
I think that the FTP service is not running, or running on an alternate port. Take a look at the output from netstat -nltp (on Linux) or netstat -ntlb (on windows). You should see a program that is waiting to hear request on TCP port 21. If you don't see the program listed at all or not on the expected port that your client is going to try and connect to, then modify the FTP servers configuration file.

Categories