Prevent Password from Expiring

Refer: https://www.cyberciti.biz/tips/setting-off-password-aging-expiration.html

List current settings

chage -l username

Example

Last password change   : Dec 16, 2023
Password expires   : Mar 15, 2024
Password inactive   : never
Account expires   : never
Minimum number of days between password change   : 5
Maximum number of days between password change   : 90
Number of days of warning before password expires   : 7

Update settings (All Settings)

chage username

Increase Max Password Age ONLY

chage -I -1 -m 0 -M 99999 -E -1 username

Skip password with sudo command

To execute the systemctl restart bluetooth command without entering a password on Ubuntu Linux 20.04, you can set up a specific sudoers configuration. This allows your user account to execute this specific command without being prompted for a password.

Follow these steps:

Open the sudoers file using the visudo command. It's essential to use visudo to edit the sudoers file to prevent syntax errors:

sudo visudo

Scroll down or navigate to the bottom of the file and add the following line:

your_username ALL=(ALL) NOPASSWD: /bin/systemctl restart bluetooth

Replace your_username with your actual username on the system. This line grants your user account permission to run the specified command without a password prompt.

Save the changes and close the editor. In visudo, you can save by pressing Ctrl + X, then Y to confirm changes, and Enter to exit.

Now, when you run sudo systemctl restart bluetooth with the specified username, it shouldn't prompt for a password. Remember to be cautious when modifying sudoers, as incorrect settings might impact system security. Always follow best practices and ensure you're aware of the security implications.