Managing User Password Expiration with chage

I want to talk a little about a Linux tool called chage which should be available on most Linux distributions with base installation. Yes chage this is not a typo. It is a tool to view and change the user password expiry information. It can be used to list the current password status of a user and also to set the password expiry information. I encountered it when one day after installing some service on a Linux server it just refused to work as expected. The root cause of it all was the dedicated user’s password had expired. You can get the details of the user password expiry information by running sudo chage -l youruser. The output will look something like this: ...

February 23, 2025 · Andrius

Redirecting Output of Multiple Commands

Sometimes when writing a script you want to redirect the output of multiple commands to a file. This is useful when debugging or when you want to generate a file that is the result of multiple commands. The naive approach is to redirect the output of each command to the file: echo "Hello" > file.txt echo "World" >> file.txt There are several issues with this approach. You have to make sure that the first redirect is > and the following ones are >> otherwise you will overwrite the file when you meant to append to it. As you write and tune your script this is a very likely mistake to make. Also you have keep repeating the same file name which is also error prone though this can be mitigated by introducing a variable and using that instead. Another thing is that it’s not very efficient because the file is opened and closed multiple times. It’s also not atomic, meaning that if the file is accessed by another process the results are unpredictable. ...

February 19, 2025 · Andrius

Getting Table Sizes in MySQL

Sometimes, like when evaluating an open source project, you might want to understand how the database entries grow based on your typical usage. This will allow you to find the hot tables i.e. the ones that grow the fastest and will help you plan ahead to make sure it scales. As this is something that would usually take place in a development environment or on a local machine you should have the root access to the database. The examples bellow assume your password is mypwd and schema name is schema1. ...

February 19, 2025 · Andrius