TECHIES WORLD

For Techs.... Techniques.... Technologies....

CpanelLinux

How to change Linux user password without any user interaction

We can change the password for a Linux user using the default command 'passwd'. But this command required user inputs to complete the processing. So it's difficult to use this utility in shell scripts.

There is an alternate way to modify the Linux user password without any user interactions.

#echo username:password | chpasswd

Here we need to replace username and password with the corresponding values. Since we are giving the username and password as a one liner along with the command, there is no further user interactions required. So this method can be used in shell scripts as well.

That's all…

Leave a Reply