PermissionError:[Errno 13]权限被拒绝:尽管在AWS EC2实例上正确运行,但无法在浏览器上打开Jupyter

问题描述 投票:1回答:1

我已经在AWS上设置了一个EC2实例(ubuntu,eu-central-1b)。在AWS(任何地方)上打开端口8888(自定义tcp规则),https 443和ssh 22。我知道chmod 400 key.pem和jupyter_notebook_config.py主题。它也成功地在EC2实例上设置了Anaconda3-5x和Jupyter。但是:我无法在浏览器(Firefox和Safari)上访问Jupyter服务器。登录到EC2实例后启动jupyter笔记本时,我得到PermissionError:[Errno 13] Permission denied错误消息。在浏览器中,我只是得到一个连接已超时的错误消息。

我几乎遵循了每个教程,例如:

https://chrisalbon.com/aws/basics/run_project_jupyter_on_amazon_ec2/https://github.com/mGalarnyk/Installations_Mac_Ubuntu_Windows/tree/master/AWS

我现在尝试了几次,终止了EC2实例并重新设置了整个事情。但是,我仍然无法通过浏览器连接到Jupyter服务器。

当我尝试在浏览器中连接/输入URL时,确切的错误消息如下所示:

(base) ubuntu@ip-172-31-34-13:~$ jupyter notebook [I 15:44:20.930 NotebookApp] JupyterLab extension loaded from /home/ubuntu/anaconda3/lib/python3.7/site-packages/jupyterlab
[I 15:44:20.930 NotebookApp] JupyterLab application directory is /home/ubuntu/anaconda3/share/jupyter/lab
[I 15:44:20.934 NotebookApp] Serving notebooks from local directory: /home/ubuntu
[I 15:44:20.934 NotebookApp] The Jupyter Notebook is running at:
[I 15:44:20.934 NotebookApp] https://(ip-172-31-34-13 or 127.0.0.1):8888/
[I 15:44:20.934 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
Exception in callback BaseAsyncIOLoop._handle_events(6, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(6, 1)>
Traceback (most recent call last):
  File "/home/ubuntu/anaconda3/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/platform/asyncio.py", line 122, in _handle_events
    handler_func(fileobj, events)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/s**tack_context.py", line 300, in null_wrapper
    return fn(*args, **kwargs)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 262, in accept_handler
    callback(connection, address)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/tcpserver.py", line 263, in _handle_connection
    do_handshake_on_connect=False)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 565, in ssl_wrap_socket
    context = ssl_options_to_context(ssl_options)
  File "/home/ubuntu/anaconda3/lib/python3.7/site-packages/tornado/netutil.py", line 540, in ssl_options_to_context
    context.load_cert_chain(ssl_options['certfile'], ssl_options.get('keyfile', None))**

当我使用'https://(AWS Public DNS):8888'或'https://(AWS IPv4 Public IP)时也没有区别:8888'

我尝试了一个不同的端口(8889)和类似的东西。

作为一个信息,我的notebook_config看起来像:

c = get_config()

c.IPKernelApp.pylab = 'inline'
c.NotebookApp.certfile = u'/home/ubuntu/certs/mycert.pem'
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser = False
c.NotebookApp.password = u'sha1:xxxxx'
c.NotebookApp.port = 8888

Everythings基本上就像他们在教程中所展示的一样。我试过它,就像他们在AWS上正式展示一样:https://docs.aws.amazon.com/dlami/latest/devguide/setup-jupyter-config.html

amazon-web-services amazon-ec2 ssh permissions jupyter
1个回答
1
投票

它可能是cert.pem文件的权限错误。假设mycert.pem文件中列出的notebook_config目录正确,从SSH到EC2实例的终端,您可以使用以下命令:

sudo chown $USER:$USER /home/ubuntu/certs/mycert.pem

可能重复此问题:Trouble with Jupyter certifications

© www.soinside.com 2019 - 2024. All rights reserved.