Shell

This executable can spawn an interactive system shell.
  1. CommentThis creates a nohup.out file in the current working directory.
    This function can be performed by any unprivileged user.
    nohup /bin/sh -c '/bin/sh </dev/tty >/dev/tty 2>/dev/tty'
    This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
    RemarksIf there are environment variables involved, they must be passed via sudo VAR=value ... or exported then sudo -E ....
    nohup /bin/sh -c '/bin/sh </dev/tty >/dev/tty 2>/dev/tty'
    This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
    RemarksThis executable runs commands directly, e.g., via functions like exec, remember to omit the -p argument of every /bin/sh invocation for distributions where the default shell does not drop SUID privileges.
    nohup /bin/sh -p -c '/bin/sh -p </dev/tty >/dev/tty 2>/dev/tty'

Command

This executable can run non-interactive system commands.
  1. CommentThe nohup.out file contains the standard output and error of the command.
    This function can be performed by any unprivileged user.
    nohup /path/to/command
    cat nohup.out
    This function is performed by the privileged user if executed via sudo because the acquired privileges are not dropped.
    RemarksIf there are environment variables involved, they must be passed via sudo VAR=value ... or exported then sudo -E ....
    nohup /path/to/command
    cat nohup.out
    This function is performed by the privileged user if the executable has the SUID bit set and the right ownership because the effective privileges are not dropped.
    nohup /path/to/command
    cat nohup.out