Select Page

Change sudo time and show asterisks when typing

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 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.

 

How to make sudo sessions last longer

This is a really easy, you just need to use visudo tool

sudo visudo

and change the line:

Defaults env_reset

to:

Defaults env_reset,timestamp_timeout=30

Where, of course, timeout=30 refers to the number of minutes you want the session to be available. You can also change this value to 0 if you want to ask for the password every time sudo is used, or use -1 in case you don’t want to ask for the password at all.

 

Aster*sks

If you don’t like to be blind when typing your passwords in the terminal, you can also add a little ‘hack’ when editing /etc/sudoers to make the shell show you asterisks instead of a desert of emptiness 🙁

sudo visudo

adding:

Defaults env_reset,pwfeedback
Now when you use sudo command you will see cute asterisks!

 

All in one

Finally, you maybe would like to include all this in a script so here it is:

 

echo 'Defaults env_reset,pwfeedback,timestamp_timeout=30' | sudo EDITOR='tee -a' visudo
Cool, isn’t it?

Syncronize datetime in manjaro

I’d been noticing for some time that my computer clock wasn’t showing the correct time. I realized about it by comparing it with server clocks I administer, so I thought my PC wasn’t using an NTP server for syncing time & date.

Today I remembered and it resulted easier than I thought. Firstly I issued this command in a terminal to check it:

> timedatectl
Local time: lun 2019-08-19 18:11:19 -03
Universal time: lun 2019-08-19 21:11:19 UTC
RTC time: lun 2019-08-19 21:11:19
Time zone: America/Montevideo (-03, -0300)
System clock synchronized: no
NTP service: no
RTC in local TZ: no

Here you can clearly see that NTP service is disabled, so I had to enable it by running the following command:

> sudo timedatectl set-ntp true

After that checking again with timedatectl we get:

Local time: lun 2019-08-19 20:43:43 -03
Universal time: lun 2019-08-19 23:43:43 UTC
RTC time: lun 2019-08-19 23:43:43
Time zone: America/Montevideo (-03, -0300)
System clock synchronized: yes
NTP service: active
RTC in local TZ: no

Done! Time and date synced.

Alojado por ProNetHosting.uy