How to get sudo to prompt you for a password each time in linux

10:44:00 AM Mahesh Kumar Yadav 1 Comments

Open Terminal and type:
sudo visudo
Then scroll down to the line that reads:
Defaults        env_reset
And change it to:
Defaults        env_reset,timestamp_timeout=0
You can change 0 to any values (time in minutes). Setting it to 0 will ask for your password every time and -1 will make it never ask. The default is 15 according to man sudo 8, but some manuals say the default is 5. Have a look at the RootSudoTimeout wiki for more information.
Press CTRL + X to finish editing, Y to save changes, and ENTER to exit.


How to change disk checking (fsck) frequency at boot?

10:11:00 PM Mahesh Kumar Yadav 1 Comments

Ubuntu checks the root partition at about every 30th boot. If you have a desktop machine/laptop that you switch off every day, this number may be too small. In this case you can safely increase this number to 50 at least.
First, figure out where your root partition is using the df command which produces this result in my case:
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda6             30850168   9374588  19908444  33% /
/dev/sda8            129636480  52663092  76973388  41% /media/DATA
So my root partition (‘/‘) is at /dev/sda6.
Then check out your disk checking frequency:
sudo dumpe2fs /dev/sda6 | grep -i "mount count"
Where you need to replace /dev/sda6 with the value that is specific to your root partition. Its output is something like this:
dumpe2fs 1.42.13 (17-May-2015)
Mount count:              12
Maximum mount count:      26
Finally, if I want to increase the frequency to 50:
sudo tune2fs -c 50 /dev/sda6 
To disable file system integrity check for forever. Type following command
sudo tune2fs -c -1 /dev/sda6 
To check after 1 month. Type following command
sudo tune2fs -i 1m /dev/sda6 
List  the  contents  of the filesystem superblock, including the current values of the parameters that can be set via  this  pro‐gram.
sudo tune2fs -l /dev/sda6
Where, again, you might need to replace /dev/sda6.