0

The OS is Ubuntu server 20.04 LTS(HVM)

I am trying to configure a server to start Jupyter notebook service when it boots. The problem is it refuses connections. I don't know why.

The notebook, and the virtual environment, below to another user (not root).

  1. Starting the notebook service manually as the other user works

    If I ssh into the server, su to the other user, enter the password for that user, cd to their home directory and start the notebook service then it works. That is, it does not refuse connections.

  2. Starting the notebook service manually as root does not work. In this case, the startup script runs as root and connections are refused. In this case, the notebook service appears to start normally but refuses connections from the outside world.

  3. Starting the notebook service automatically does not work

The script I use to start it is

       cd /home/anna_user2
       source .venv/jupyter/bin/activate
       jupyter notebook

I could su to the other user within the startup script, but in my limited understanding there are two issues:

  1. su asks for a password even if NOPASSWD is set via visudo
  2. The posts I have seen on forums always ask "why do you want to su within a script?" which leads me to believe that I should not do that and that there is a better way.

I start the virual environment with the command source ~/.venv/jupyter/bin/activate. One cannot sudo source... (command not found)

The server is an Amazon AWS instance and this service provides the ability to specify a script ("User data) that runs at boot time.

The reason I am asking here is that it seems to be a user permissions issue. I was hoping to get some insight as to why the service doesn't work if it is started by root and/or the issues around using su inside a script.

0 Answers0