Say I started a su command, and I want to cancel it. Control+C doesn't work for su like it does for sudo... I have to finish the prompt (either by getting the password wrong enough times or by getting it right).

Is there something that I can type to kill a password prompt?


3 Answers 3


You can CTRL-D su's prompt.
This shortcut signals an end-of-file on the console, quitting the prompt; the console will display Authentication error, which is expectable.

  • 3
    Control-D would be an EOF (QUIT is a different thing, and is usually caught). But yes, EOF could work. Mar 2, 2016 at 2:26

su is running with elevated privileges, and you are not seeing it respond to ^C (which sends a signal with your privileges). You could su to another shell and kill it from the other shell. Also (depending on the system), it might respond to SIGHUP (a hangup signal) if you closed the terminal session where the awkward su is in progress.

There's more than one way that su can ignore your ^C, e.g.,

  • establishing signal handlers or
  • running under a different controlling terminal.

A quick read of Debian's su seems that it uses the latter. Your system of course may be different.

Further reading:

  • If I execute su as a regular user and it is waiting for a password input from user, is it "running with elevated privileges" at this moment?
    – techraf
    Mar 2, 2016 at 1:41
  • 1
    Yes: you can see for yourself by doing a ps -ef from another terminal. That happens automatically because su is setuid'd to root. Mar 2, 2016 at 1:42

I've found the best way to kill su during entering of an incorrect password is Control+U followed by Control+D. This should avoid annoying delays. You can also just clear the input with Control+U and re-try typing the password in.

Control+U is a command that clears the current line of text, and also works in a shell (and probably other places too). It's also nice that it seems to work with su to clear the currently-entered password.

Using Control+C doesn't seem to work, it appears that for some reason su just ignores it. It is untrue that the user who started the process can no longer kill it because of setuid -- su dies perfectly fine if you kill it with SIGTERM or SIGQUIT from another terminal (as a user that started it). SIGINT doesn't work, so su probably just ignores it.

Control+D with an empty password input seems to be the only way to instantly kill a running su - if any text is entered, then hitting Control+D will induce a 3-second delay (unless you've actually typed in the correct password, in which case... it'll start a root shell).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.