How To Display A Custom Password Requirement Message For Linux Password Changes
Share on facebook
Share on twitter
Share on linkedin

How To Display A Custom Password Requirement Message For Linux Password Changes

Anthony James
Anthony James

I have implemented a new passwd policy and am forcing users to change their password. The problem I’m facing is I don’t they dont’ know what the password requirements are. How can I communicate this to them before they change their password using passwd?

That’s a great question, and it’s actually really simple. What we have to do is create our own custom script that displays the password requirements and then calls the passwd program. And we have to call the script whenever  a user types passwd command at the prompt.

Which passwd

On an Ubuntu system if we type “which passwd” we see the real location to our password program. We’ll need this location in order to call the real program in our script.

[LinuxAcademy $] which passwd/usr/bin/passwd

Custom passwd Script With Password Requirements

#!/bin/bashecho” *****password requirements*******”echo “please use at least one lower case and upper case letter”echo “please use at lease 2 charecters”echo” but you cant use the * charecter”echo “and one must be a ! “echo “and you must tap your head and pet your belly while you enter your password”/usr/bin/passwd

Make It Work, By Editing Environment Variables

Edit one of your global environment configuration files. Either /etc/bashrc /etc/profile could be different depending on your distribution.Create the alias line

alias passwd=”./location/to/custom_passwd”

Whenever someone logs into the system this alias is created. Once they type “passwd” at the command prompt your script is run, which displays the password requirements, then calls the real password program.   

Recommended

Get more insights, news, and assorted awesomeness around all things cloud learning.

Get Started

Who’s going to be learning?

Thanks for reaching out!

You’ll hear from us shortly. In the meantime, why not check out what our customers have to say about ACG?

How many seats do you need?

  • $499 USD per seat per year

  • Billed Annually

  • Renews in 12 months

Ready to accelerate learning?

For over 25 licenses, a member of our sales team will walk you through a custom tailored solution for your business.


$2,495.00

Checkout