• [^] # Re: sudo -i

    Posté par . En réponse au message Se connecter à l'user root. Évalué à 2. Dernière modification le 24 mars 2020 à 16:47.

    sudo -s marche aussi ( ou pas, parce que je n'ai pas vraiment cherché à comprendre la différence entre sudo -i et sudo -s)

    Edit: la man page de sudo nous dit :

    -i [command]
    The -i (simulate initial login) option runs the shell specified by the password database entry of the target user as a login shell. This means that login-specific resource files such as .profile or .login will be read by the shell. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed. sudo attempts to change to that user's home directory before running the shell. The security policy shall initialize the environment to a minimal set of variables, similar to what is present when a user logs in. The Command Environment section in the sudoers(5) manual documents how the -i option affects the environment in which a command is run when the sudoers policy is in use.

    -s [command]
    The -s (shell) option runs the shell specified by the SHELL environment variable if it is set or the shell as specified in the password database. If a command is specified, it is passed to the shell for execution via the shell's -c option. If no command is specified, an interactive shell is executed.