When we run a command by sudo, the password is asked

[sudo] password for user

If the sudo is not typed the password should not be asked. If asked, I would assume it as a fraud by the application.

How about graphical applications which ask us password through a GUI? If asked for password, how can we differentiate between Linux original password dialogue or a dialogue generated by the application to look like Linux one?

Authentication dialog

migrated from serverfault.com Jan 4 '15 at 23:46

This question came from our site for system and network administrators.


When I worry about this, I run sudo -k; sudo date && sudo -n wooden-horse-command. Then I'll be prompted for the password exactly once (by sudo date), and the sudo ticket should be fresh for the following command.

Not that this gains much in terms of security, you understand. A malicious program that installs a keylogger will be more effective at grabbing your password, even if it isn't run as root.


One way might be to run ps -A or ps aux to see what the corresponding process could be if you feel suspicious. Then bring up the original password gui prompt, do a ps again and compare it to the 'suspicious' one.

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.