{ "cells": [ { "cell_type": "markdown", "metadata": { "toc": "true" }, "source": [ "# Table of Contents\n", "

1  Demonstration of running a Jupyter notebook with sudo rights
1.1  Without sudo rights
1.2  With sudo rights
1.3  Conclusion
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Demonstration of running a Jupyter notebook with sudo rights" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Without sudo rights\n", "\n", "The next cells were first ran when Jupyter was not running with sudo rights." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Lecture des listes de paquets... Fait\n", "E: Le répertoire /var/lib/apt/lists/partial pour les listes n'existe pas. - Acquire (13: Permission non accordée)\n", "W: Problème de suppression du lien /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission non accordée)\n", "W: Problème de suppression du lien /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission non accordée)\n" ] } ], "source": [ "!apt update" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[sudo] Mot de passe de lilian : \n" ] } ], "source": [ "!sudo apt update" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "As we see here, using `sudo ...` asks for a password, but it doesn't work from Jupyter." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## With sudo rights\n", "The next cells were then ran when Jupyter was running with sudo rights." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Réception de:1 http://archive.canonical.com/ubuntu bionic InRelease [10,2 kB] m\n", "Réception de:2 http://ppa.launchpad.net/audio-recorder/ppa/ubuntu bionic InRelease [15,9 kB]\n", "Réception de:3 http://archive.canonical.com/ubuntu bionic/partner Sources [1 904 B]3mm\u001b[33m\n", "Réception de:4 http://archive.canonical.com/ubuntu bionic/partner i386 Packages [2 300 B]\n", "Réception de:5 http://archive.canonical.com/ubuntu bionic/partner amd64 Packages [2 304 B]\n", "Réception de:6 http://archive.canonical.com/ubuntu bionic/partner Translation-en [1 272 B]\n", "Réception de:7 http://ppa.launchpad.net/costales/anoise/ubuntu bionic InRelease [15,4 kB]\n", "0% [Connexion à fr.archive.ubuntu.com] [Attente des fichiers d'en-tête] [7 In\u001b[0mm\u001b[33m^C\n" ] } ], "source": [ "!apt update" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It works!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Conclusion\n", "\n", "It works!" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.7" }, "toc": { "colors": { "hover_highlight": "#DAA520", "running_highlight": "#FF0000", "selected_highlight": "#FFD700" }, "moveMenuLeft": true, "nav_menu": { "height": "11.6667px", "width": "251.667px" }, "navigate_menu": true, "number_sections": true, "sideBar": false, "threshold": 4, "toc_cell": true, "toc_section_display": "block", "toc_window_display": true } }, "nbformat": 4, "nbformat_minor": 2 }