I want to know whether it is possible to indicate on the command-line (ideally in the prompt), whether sudo mode is on.
By sudo mode I mean that I have already entered my password correctly once in this shell session and it has not expired yet but is still cached.
In other words, can I tell somehow whether the sudo
command I'm going to run will ask me for my password or will use the cached credentials?
date
as the cached credentials will expire after 15 mins... Related: http://askubuntu.com/questions/190311/sudo-credential-caching-on-by-default – Elder Geek Oct 18 '16 at 17:50sudo
command was running within the last 15 minutes. – Byte Commander Oct 18 '16 at 17:54sudo -i
and you'd know you were superuser because your prompt would change to#
from$
– Elder Geek Oct 18 '16 at 18:01