Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 4 years ago.
Improve this question
I want to run a jupyter notebook server in a machine to which I have ssh access and that I am already able to run notebooks locally.
How can I setup the jupyter notebook so it can be accessed remotely?
If you have ssh access to the machine that will run the server, follow the next steps:
1) In the machine that you will run the server, execute:
jupyter notebook # To start the server with the default port forwarding (8888)
2) Take note of the notebook address: that will be shown to you in the terminal: http://localhost:8888/?token=<A_LONG_STRING_OF_NUMBERS_AND_LETTERS>
3) In the client machine, with remote access to the server:
ssh -N -L localhost:8888:localhost:8888 <server_username>#<server_ip>
4) Now, open the browser to use the following address: http://localhost:8888/?token=<THE_TOKEN>
Additional info (found here): It is possible to change the port on which the server is setup
# In the server
jupyter notebook --no-browser --port=8889
# In the client
ssh -N -L localhost:8888:localhost:8889 <server_username>#<server_ip>
Related
I have a linux server. On that I have installed Miniconda3 and other python packages along with Jupyter.
Now I want to run the notebook on the server and open in my browser.
For that, after installation of all packages, I do:
user#remoteip:$ jupyter notebook --no-browser --port=8890
Now I am copying the server IP address along with port to open it in my local browser.
http://remoteip:8890
However it doesn't open up anything.
I then followed all suggestions given in this SO answer by adding the required statements in the configuration file on the remote server anaconda and even local anaconda jupyter config file.
But it doesn't help at all.
After that I had to port forwarding as below in my local terminal:
user#localhost: ssh -N -f -L localhost:8890:localhost:8890 user#remoteip
And after that when I open
localhost:8890
now it opens up the notebook requiring the token to be entered and then it works.
My question is that do we need to do port forwarding everytime for us to open a notebook on remote server? One of my colleague said he didn't do any port forwarding and after first step itself, he was able to open the notebook with by typing
http://remoteip:8890
So I am not sure we need to do port forwarding for us to open the server jupyter notebook to open in browser or we can directly open the notebook with remoteip address?
Edit:
As per Alex's suggestion below, ran the following command after logging into dev server.
(ds_env) user#devvm1049:~$ jupyter notebook --no-mathjax --no-browser --ip 0.0.0.0 --port 8890
[I 23:49:56.032 NotebookApp] Serving notebooks from local directory: /home/user
[I 23:49:56.032 NotebookApp] The Jupyter Notebook is running at:
[I 23:49:56.032 NotebookApp] http://devvm.cdw.com:8890/
[I 23:49:56.032 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Copied the above link to both chrome and Safari but it didn't open anything.
I have already done the above suggestions in this post. The only thing that has worked until now is doing Port tunneling but that is 3 steps everytime one has to open the jupyter on remote server.
Is this can be some port blocking issue? I tried pinging the remote server on laptop and it didn't give me any ping.
If you specify the --ip option when starting the server you can allow remote connection without port forwarding.
jupyter notebook --no-mathjax --no-browser --ip 0.0.0.0 --port 8890
# The --no-mathjax improves loading over slow connections
This is not recommended, though. See running a public jupyter notebook server. If you do this, I strongly recommend that you set a password, as described in that link.
I have a problem with connecting to jupyter that I run on remote computer. I have configured jupyter with ssl as in the following doc:
https://jupyter-notebook.readthedocs.io/en/latest/public_server.html#hashed-pw
Then I run jupyter on remote machine with command: jupyter notebook as in tutorial.
When its running I make a tunnel in another terminal by running a command:
ssh -N -f -L 8889:127.0.0.1:8881 user_name#hostname.com
Of course the jupyter is running on port 8881. When I open the browser on my local computer and try to open page:
localhost:8889
I got an error that connection was reset, and in command line the ssh returns the following error:
channel 2: open failed: connect failed: Connection refused
Can anyone help me? I was looking for an answer for whole day and still can't fix it.
The problem is, that in my case jupyter is running on localhost. At my server remote server I have no access to remote localhost, so the solution was quite easy - I run jupyter on specified ip = 0.0.0.0
jupyter notebook --no-browser --port=8881 --ip=0.0.0.0
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.
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.
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.