{"id":348,"date":"2019-09-07T22:03:16","date_gmt":"2019-09-08T01:03:16","guid":{"rendered":"https:\/\/mauriciolopez.ml\/?p=348"},"modified":"2019-09-07T22:12:28","modified_gmt":"2019-09-08T01:12:28","slug":"change-sudo-time-and-show-asterisks-when-typing","status":"publish","type":"post","link":"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/","title":{"rendered":"Change sudo time and show asterisks when typing"},"content":{"rendered":"<h2>Not enough time!<\/h2>\n<p>When you use sudo in Linux, a session that lasts 15 minutes by default, is created. This may be not enough time for a user to complete a task as root, in my case, everytime QownNotes package is updated (usually every day!) it last more than this time to finish it compilation process, so I need to reenter my password, but when this terminal window is in the background the time for asking the password also expires and I need to restart the update process.<\/p>\n<p>&nbsp;<\/p>\n<h2>How to make sudo sessions last longer<\/h2>\n<p>This is a really easy, you just need to use <em>visudo<\/em> tool<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">sudo visudo<\/code><\/p>\n<p>and change the line:<\/p>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">Defaults        env_reset<\/code><\/p>\n<p>to:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">Defaults env_reset,timestamp_timeout=30<\/pre>\n<p>Where, of course, <code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">timeout=30<\/code> refers to the number of minutes you want the session to be available. You can also change this value to <code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">0<\/code> if you want to ask for the password every time sudo is used, or use <code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">-1<\/code> in case you don&#8217;t want to ask for the password at all.<\/p>\n<p>&nbsp;<\/p>\n<h2>Aster*sks<\/h2>\n<p>If you don&#8217;t like to be blind when typing your passwords in the terminal, you can also add a little &#8216;hack&#8217; when editing \/etc\/sudoers to make the shell show you asterisks instead of a desert of emptiness \ud83d\ude41<\/p>\n<div>\n<p><code class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">sudo visudo<\/code><\/p>\n<p>adding:<\/p>\n<\/div>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">Defaults env_reset,pwfeedback<\/pre>\n<div>Now when you use sudo command you will see cute asterisks!<\/div>\n<p>&nbsp;<\/p>\n<h2>All in one<\/h2>\n<p>Finally, you maybe would like to include all this in a script so here it is:<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">echo 'Defaults env_reset,pwfeedback,timestamp_timeout=30' | sudo EDITOR='tee -a' visudo<\/pre>\n<div>Cool, isn&#8217;t it?<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Not enough time! When you use sudo in Linux, a session that lasts 15 minutes by default, is created. This may be not enough time for a user to complete a task as root, in my case, everytime QownNotes package is updated (usually every day!) it last more than this time to finish it compilation [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[3],"tags":[],"class_list":["post-348","post","type-post","status-publish","format-standard","hentry","category-blog"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Change sudo time and show asterisks when typing &#8226; Mauricio&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Change sudo time and show asterisks when typing &#8226; Mauricio&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"Not enough time! When you use sudo in Linux, a session that lasts 15 minutes by default, is created. This may be not enough time for a user to complete a task as root, in my case, everytime QownNotes package is updated (usually every day!) it last more than this time to finish it compilation [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/\" \/>\n<meta property=\"og:site_name\" content=\"Mauricio&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-09-08T01:03:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-09-08T01:12:28+00:00\" \/>\n<meta name=\"author\" content=\"Mauricio L\u00f3pez\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@damonhillf1\" \/>\n<meta name=\"twitter:site\" content=\"@damonhillf1\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mauricio L\u00f3pez\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/\"},\"author\":{\"name\":\"Mauricio L\u00f3pez\",\"@id\":\"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/f229529d803fab049acb2834cd2d119d\"},\"headline\":\"Change sudo time and show asterisks when typing\",\"datePublished\":\"2019-09-08T01:03:16+00:00\",\"dateModified\":\"2019-09-08T01:12:28+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/\"},\"wordCount\":251,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/f229529d803fab049acb2834cd2d119d\"},\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/\",\"url\":\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/\",\"name\":\"Change sudo time and show asterisks when typing &#8226; Mauricio&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/mauriciolopez.dev\/en\/#website\"},\"datePublished\":\"2019-09-08T01:03:16+00:00\",\"dateModified\":\"2019-09-08T01:12:28+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Inicio\",\"item\":\"https:\/\/mauriciolopez.dev\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Change sudo time and show asterisks when typing\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/mauriciolopez.dev\/en\/#website\",\"url\":\"https:\/\/mauriciolopez.dev\/en\/\",\"name\":\"Mauricio&#039;s Blog\",\"description\":\"Software libre, tecnolog\u00eda, Uruguay y piques varios\",\"publisher\":{\"@id\":\"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/f229529d803fab049acb2834cd2d119d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/mauriciolopez.dev\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/f229529d803fab049acb2834cd2d119d\",\"name\":\"Mauricio L\u00f3pez\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f879e03123eded9c9eab8c3048b2e8cfdfcbdecf6fe1d39d61c9dd1cb3f7a796?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f879e03123eded9c9eab8c3048b2e8cfdfcbdecf6fe1d39d61c9dd1cb3f7a796?s=96&d=monsterid&r=g\",\"caption\":\"Mauricio L\u00f3pez\"},\"logo\":{\"@id\":\"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/damonhillf1\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Change sudo time and show asterisks when typing &#8226; Mauricio&#039;s Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/","og_locale":"en_US","og_type":"article","og_title":"Change sudo time and show asterisks when typing &#8226; Mauricio&#039;s Blog","og_description":"Not enough time! When you use sudo in Linux, a session that lasts 15 minutes by default, is created. This may be not enough time for a user to complete a task as root, in my case, everytime QownNotes package is updated (usually every day!) it last more than this time to finish it compilation [&hellip;]","og_url":"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/","og_site_name":"Mauricio&#039;s Blog","article_published_time":"2019-09-08T01:03:16+00:00","article_modified_time":"2019-09-08T01:12:28+00:00","author":"Mauricio L\u00f3pez","twitter_card":"summary_large_image","twitter_creator":"@damonhillf1","twitter_site":"@damonhillf1","twitter_misc":{"Written by":"Mauricio L\u00f3pez","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/#article","isPartOf":{"@id":"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/"},"author":{"name":"Mauricio L\u00f3pez","@id":"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/f229529d803fab049acb2834cd2d119d"},"headline":"Change sudo time and show asterisks when typing","datePublished":"2019-09-08T01:03:16+00:00","dateModified":"2019-09-08T01:12:28+00:00","mainEntityOfPage":{"@id":"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/"},"wordCount":251,"commentCount":0,"publisher":{"@id":"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/f229529d803fab049acb2834cd2d119d"},"articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/","url":"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/","name":"Change sudo time and show asterisks when typing &#8226; Mauricio&#039;s Blog","isPartOf":{"@id":"https:\/\/mauriciolopez.dev\/en\/#website"},"datePublished":"2019-09-08T01:03:16+00:00","dateModified":"2019-09-08T01:12:28+00:00","breadcrumb":{"@id":"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/mauriciolopez.dev\/en\/change-sudo-time-and-show-asterisks-when-typing\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Inicio","item":"https:\/\/mauriciolopez.dev\/en\/"},{"@type":"ListItem","position":2,"name":"Change sudo time and show asterisks when typing"}]},{"@type":"WebSite","@id":"https:\/\/mauriciolopez.dev\/en\/#website","url":"https:\/\/mauriciolopez.dev\/en\/","name":"Mauricio&#039;s Blog","description":"Software libre, tecnolog\u00eda, Uruguay y piques varios","publisher":{"@id":"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/f229529d803fab049acb2834cd2d119d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/mauriciolopez.dev\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/f229529d803fab049acb2834cd2d119d","name":"Mauricio L\u00f3pez","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/f879e03123eded9c9eab8c3048b2e8cfdfcbdecf6fe1d39d61c9dd1cb3f7a796?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f879e03123eded9c9eab8c3048b2e8cfdfcbdecf6fe1d39d61c9dd1cb3f7a796?s=96&d=monsterid&r=g","caption":"Mauricio L\u00f3pez"},"logo":{"@id":"https:\/\/mauriciolopez.dev\/en\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/x.com\/damonhillf1"]}]}},"_links":{"self":[{"href":"https:\/\/mauriciolopez.dev\/en\/wp-json\/wp\/v2\/posts\/348","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mauriciolopez.dev\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mauriciolopez.dev\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mauriciolopez.dev\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mauriciolopez.dev\/en\/wp-json\/wp\/v2\/comments?post=348"}],"version-history":[{"count":0,"href":"https:\/\/mauriciolopez.dev\/en\/wp-json\/wp\/v2\/posts\/348\/revisions"}],"wp:attachment":[{"href":"https:\/\/mauriciolopez.dev\/en\/wp-json\/wp\/v2\/media?parent=348"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mauriciolopez.dev\/en\/wp-json\/wp\/v2\/categories?post=348"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mauriciolopez.dev\/en\/wp-json\/wp\/v2\/tags?post=348"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}