Skip to main content

How to connect to notebook via SSH

When creating a notebook, you can securely access it remotely via SSH to transfer files and perform tasks.

info

SSH access to notebooks is supported only for default provided images. You can check the default provided images in Supported notebook images.

Configure SSH

  1. When creating a notebook, enable Enable SSH Connection at the bottom.

    info

    If you do not assign a volume during notebook creation to the user directory /home/{user-name} created when accessing via SSH, the contents of that directory may be lost after stopping and restarting the notebook.
    For safe operations, assign a volume to a mounted directory or to the user directory as shown in the image.

    Image. Enable SSH Connection Enable SSH Connection

  2. After the notebook is created, hover over Use SSH in the menu to check the SSH command random port.

    Image. Check SSH random port Check SSH random port

  3. Click the [Manage Account] button in the left Kubeflow menu to check the SSH password.

    info

    The SSH password is exposed identically to users within the same namespace.

  4. Try accessing via SSH from a local terminal.

    info
    • When prompted with Are you sure you want to continue connecting (yes/no/[fingerprint])?, enter yes.
    • The username used for SSH access is the username included in the notebook creator’s email address. To add users, log in with the notebook creator account and use the adduser command.

    Image. SSH access SSH access

Verify SSH service status

You can verify whether the SSH service is running properly using the following command in the notebook terminal.

SSH service running normally
$ sudo service ssh status
* sshd is running

Use SCP

  1. Check the port and account information required for SCP.

    info

    To use SCP, Enable SSH Connection must be enabled during notebook creation.

    Image. Check SSH random port Check SSH random port

  2. Try SCP from a local terminal.

    info
    • Enter scp -P {SSH command random port} {Source File PATH} {Username@Domain}:{Destination PATH}.
    • When prompted with Are you sure you want to continue connecting (yes/no/[fingerprint])?, enter yes.

    Image. SCP command example SCP command example

  3. Click the [Manage Account] button in the left Kubeflow menu to check the SSH password.

    info

    You can check the SSH password from Manage Account in the Kubeflow menu.

  4. Verify the file transfer result on the Jupyter Notebook CLI after transferring files from the local terminal using SCP.

    info
    • If you specify the user home directory as in the example, files are saved to /home/{user-name}, which is the user directory created when accessing via SSH.
    • You can specify a Destination PATH for file transfer.

    Image. Verify SCP execution result Verify SCP execution result