本文介绍了PermissionError:[Errno 13]访问aws ec2时拒绝权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在虚拟机上运行ubuntu 16.04(在Mac上),并在AWS ec2 ubuntu 18.04上运行.我试图在aws.ec2上运行Jupiter笔记本,并尝试通过本地Ubuntu上的Web浏览器远程访问它.我能够访问远程ubuntu(aws.ec2)终端.在我按照此链接

I have ubuntu 16.04 running on virtual box(on mac), and on aws ec2 ubuntu 18.04 running. I am trying to run Jupiter notebook on aws.ec2 and trying to access it remotely thru my web browser on my local Ubuntu.I am able to access remote ubuntu(aws.ec2) terminal. After I followed the steps on this link

在第9步中出现以下错误.

I got the following error on the step 9.

我从头开始重新安装了3次所有内容(包括本地ubuntu和aws ec2实例),但到目前为止没有任何进展.

I reinstalled everything from scratch 3 times(including local ubuntu and aws ec2 instance), but no progress so far.

Last login: Thu Nov  1 06:34:07 2018 from 134.1****
ubuntu@ip-172-***:~$ export XDG_RUNTIME_DIR=""
ubuntu@ip-172-***:~$ jupyter notebook
[I 06:40:19.525 NotebookApp] Serving notebooks from local directory: /home/ubuntu
[I 06:40:19.528 NotebookApp] The Jupyter Notebook is running at:
[I 06:40:19.528 NotebookApp] https:// **** :8888/?token=727fbb120d19f55a435c1*****
[I 06:40:19.528 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 06:40:19.529 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        https://(ip-172-31-***** .0.1):8888/?token=727fbb120d19f55a435c14*********
ERROR:asyncio:Exception in callback BaseAsyncIOLoop._handle_events(4, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(4, 1)>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
    self._callback(*self._args)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/platform/asyncio.py", line 122, in _handle_events
    handler_func(fileobj, events)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 300, in null_wrapper
    return fn(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/netutil.py", line 262, in accept_handler
    callback(connection, address)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/tcpserver.py", line 263, in _handle_connection
    do_handshake_on_connect=False)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/netutil.py", line 565, in ssl_wrap_socket
    context = ssl_options_to_context(ssl_options)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/netutil.py", line 540, in ssl_options_to_context
    context.load_cert_chain(ssl_options['certfile'], ssl_options.get('keyfile', None))
PermissionError: [Errno 13] Permission denied
ERROR:asyncio:Exception in callback BaseAsyncIOLoop._handle_events(4, 1)
handle: <Handle BaseAsyncIOLoop._handle_events(4, 1)>
Traceback (most recent call last):
  File "/usr/lib/python3.6/asyncio/events.py", line 145, in _run
    self._callback(*self._args)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/platform/asyncio.py", line 122, in _handle_events
    handler_func(fileobj, events)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/stack_context.py", line 300, in null_wrapper
    return fn(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/netutil.py", line 262, in accept_handler
    callback(connection, address)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/tcpserver.py", line 263, in _handle_connection
    do_handshake_on_connect=False)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/netutil.py", line 565, in ssl_wrap_socket
    context = ssl_options_to_context(ssl_options)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tornado/netutil.py", line 540, in ssl_options_to_context
    context.load_cert_chain(ssl_options['certfile'], ssl_options.get('keyfile', None))
PermissionError: [Errno 13] Permission denied

注1::在ec2实例上,Ubuntu具有18.04版本,它随附了python 3.6.3,然后我必须在其顶部安装anaconda,然后python版本现在是3.5.2我输入了$ python3.

Note1: on ec2 instance, Ubuntu has 18.04 version and it came with python 3.6.3 then I have to install anaconda on the top of it and then the python version now is 3.5.2 once I typed $python3.

注2 :尽管在将anaconda安装到EC2中之后,python版本降级为3.5.2

Note2: Despite after the anaconda has been installed into the EC2 then the python version degraded to 3.5.2

一旦我检查了以下目录/usr/local/lib/,只有python3.6文件夹存在,然后键入$ sudo chmod 777 dist-packages/

once I have checked the following directory /usr/local/lib/ there only python3.6 folder is existing, then I typed $sudo chmod 777 dist-packages/

然后是$ jupyter笔记本,然后复制令牌链接并与dns结合使用,但仍然没有用.

then $jupyter notebook, then copy the token link and combine with dns, but still didn't worked.

推荐答案

我遇到了同样的问题,现在我通过尝试一些方法解决了它.尝试以下解决方案,看看是否有帮助:

I had the same problem, and now I just solved it by trying a couple things. Try these solutions to see if it helps:

  1. /home文件夹和~/.local/share/jupyter/文件夹的所有权更改为运行此命令的当前用户:
  1. Changed the ownership of the /home folder and ~/.local/share/jupyter/ folder to current user running this command:
   sudo chown -R $USER /home/

   sudo chown -R $USER ~/.local/share/jupyter/
  1. 如果遇到ssl错误问题,请查看此链接.

确保在浏览器中键入https://<jupyter-server-ip>而不是http://.

Make sure you type https://<jupyter-server-ip> in your browser instead of http://.

这篇关于PermissionError:[Errno 13]访问aws ec2时拒绝权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 11:58