Changinging password for linux users
1 posts in topic
Flat View  Flat View

Posted By:   kumar_gopi
Posted On:   Monday, September 3, 2001 11:40 PM

How can i change the password for the linux user using java programming.I tried with Runtime.getRuntime.exec("passwd") and with outputstreams of this process,but failed to change.
Can anybody help?

Re: Changinging password for linux users

Posted By:   Thomas_Mathis  
Posted On:   Tuesday, September 4, 2001 01:23 AM

Create the script chgpasswd on your linux machine and put it in the system path.


chpasswd < $1

With your java program you have to create a temp file with the following entries:



Now you can start your exec command:

String action = "chgpasswd " + tempFilePath;

Process process = runtime.exec( action );

About | Sitemap | Contact