<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>sudo &amp;mdash; alan</title>
    <link>https://www.franzoni.eu/alan/tag:sudo</link>
    <description>Alan&#39;s musings</description>
    <language>en</language>
    <pubDate>Tue, 17 Nov 2026 00:52:49 +0000</pubDate>
    <item>
      <title>I wish sudo would ask for my password less often</title>
      <link>https://www.franzoni.eu/alan/i-wish-sudo-would-ask-for-my-password-less-often</link>
      <description>&lt;![CDATA[This is a very old trick, but I find many people doesn&#39;t know about it yet.&#xA;&#xA;If you&#39;re using sudo (and you definitely should), one minor complaint is that you need to re-enter your password quite often.&#xA;&#xA;One common pseudo-solution is to completely disable the password for executing sudo with such user; while it may be a good idea sometimes, it does decrease the overall security - if you happen to forget an open shell or screen/tmux lingering somewhere, you give total power to whoever gets in touch with it.&#xA;&#xA;If you happen to let people into your sudo-enabled account with your ssh key, anybody that can get hold of your ssh key will get root access to your servers. It&#39;s not the best possible scenario.&#xA;&#xA;There&#39;s a very simply workaround: just edit your sudoers file!&#xA;&#xA;sudo visudo&#xA;&#xA;and add a line like that (or modify it if it&#39;s already there)&#xA;&#xA;Defaults    timestamp_timeout=120&#xA;&#xA;This means that sudo will ask for a password every two hours instead of the default (15 minutes on most installations). You can use -1 in order to never let it expire (I don&#39;t suggest that - 8-10 hours should be enough for everybody.)&#xA;&#xA;The only drawback is that such timeout is per shell, not system-wide - i.e. if you open multiple terminals, you&#39;ll have to enter the password again for each new terminal instance.&#xA;&#xA;#MostlyUnixish #linux #sudo&#xA;]]&gt;</description>
      <content:encoded><![CDATA[<p>This is a <strong>very</strong> old trick, but I find many people doesn&#39;t know about it yet.</p>

<p>If you&#39;re using sudo <a href="https://help.ubuntu.com/community/RootSudo" rel="nofollow">(and you definitely should)</a>, one minor complaint is that you need to re-enter your password quite often.</p>

<p>One common pseudo-solution is to completely disable the password for executing sudo with such user; while it may be a good idea sometimes, it does decrease the overall security – if you happen to forget an open shell or screen/tmux lingering somewhere, you give total power to whoever gets in touch with it.</p>

<p>If you happen to let people into your sudo-enabled account with your ssh key, anybody that can get hold of your ssh key will get <strong>root access</strong> to your servers. It&#39;s not the best possible scenario.</p>

<p>There&#39;s a very simply workaround: just edit your sudoers file!</p>

<pre><code>sudo visudo
</code></pre>

<p>and add a line like that (or modify it if it&#39;s already there)</p>

<pre><code>Defaults    timestamp_timeout=120
</code></pre>

<p>This means that sudo will ask for a password every two hours instead of the default (15 minutes on most installations). You can use -1 in order to never let it expire (I don&#39;t suggest that – 8-10 hours should be enough for everybody.)</p>

<p>The only drawback is that such timeout is per shell, not system-wide – i.e. if you open multiple terminals, you&#39;ll have to enter the password again for each new terminal instance.</p>

<p><a href="/alan/tag:MostlyUnixish" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">MostlyUnixish</span></a> <a href="/alan/tag:linux" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">linux</span></a> <a href="/alan/tag:sudo" class="hashtag" rel="nofollow"><span>#</span><span class="p-category">sudo</span></a></p>
]]></content:encoded>
      <guid>https://www.franzoni.eu/alan/i-wish-sudo-would-ask-for-my-password-less-often</guid>
      <pubDate>Tue, 11 Nov 2014 22:11:00 +0000</pubDate>
    </item>
  </channel>
</rss>