Linux

Little hacks I found useful and may need to refer to again later, cos it’s all so easy to forget.

Raspberry Pi Change Forgotten Password(s)

On the boot partition of the SD Card, the hashes of the passwords are stored in /etc/shadow, usually towards the end of the file, e.g.

fred:$6$VHuVp9oAbI./.Rc7$FSkBM8Zd3AJoC3w/Mm2hsvuIdufd1rf.Vv2bA3e0kMGACZptC8A5Xt>
nx:*:18853:0:99999:7:::

All we need is the hash itself, which is the string in between the first 2 colons, in this case, $6$VHuVp9oAbI./.Rc7$FSkBM8Zd3AJoC3w/Mm2hsvuIdufd1rf.Vv2bA3e0kMGACZptC8A5Xt> nx

Get the hash from the same location in another system that you know the password for and then copy it and paste it over the existing one, then save the file, and replace the SD card in the pi. Boot up.

Linux Mint change notifications duration

The actual time on screen for transient notifications is hardcoded on /usr/share/cinnamon/js/ui/messageTray.js. Luckily it’s a plain text javascript file so amenable to end user tweaking (after making a backup and with elevated privileges)

The hard-coded values are near the start of the file and look like this. Time is in seconds.

var NOTIFICATION_TIMEOUT = 4;
var NOTIFICATION_CRITICAL_TIMEOUT_WITH_APPLET = 10;

NOTIFICATION_TIMEOUT is the default timeout

NOTIFICATION_CRITICAL_TIMEOUT_WITH_APPLET is used if the notification is flagged by the sending app as CRITICAL and the notification applet is present. If the applet is absent critical notifications won’t timeout.

So if you wanted to tweak
Make a back up

sudo cp /usr/share/cinnamon/js/ui/messageTray.js /usr/share/cinnamon/js/ui/messageTray.js.original

Open the file with elevated privileges

xed admin:///usr/share/cinnamon/js/ui/messageTray.js

Once tweaked and saved restart Cinnamon with Ctrl-Alt-Esc

Remove lock screen and logout from Cinnamon menu

  • Make a local copy of the menu applet: cp -r /usr/share/cinnamon/applets/menu@cinnamon.org ~/.local/share/cinnamon/applets
  • open the original: xed ~/.local/share/cinnamon/applets/menu@cinnamon.org/applet.js
  • // comment out everything in //Lock screen and //Logout button all the way down to the next //
  • Save the file and close the text editor.
  • Restart Cinnamon with Ctrl-Alt-Esc.