File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes executing UNIX passwd command through Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "executing UNIX passwd command through Java" Watch "executing UNIX passwd command through Java" New topic
Author

executing UNIX passwd command through Java

Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
Hi,
Is there a way to execute UNIX's passwd command through Java? When I execute this command is UNIX shell it's interactive, so I don't see a way of simulating <enter> key through Java code. Is there another way?
thanks,
Alex


All right brain, you don't like me and I don't like you, but let's just do this one thing so I can get back to killing you with beer.<br /> <br />- Homer Simpson
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
instead u can make a C EXE and run that from java prog...
use Process class for that and Process.exe() for that...
i've nt done this but i believe its possible in C.
regards
maulin
Alex Kravets
Ranch Hand

Joined: Jan 24, 2001
Posts: 476
Right, I know it's possible to use C module for this, but I wanted to know if it was possible to do the same thing straight from java.
Dave Van Even
Ranch Hand

Joined: Jul 19, 2001
Posts: 101
this should work
echo <password> | passwd <username>

where
<password> = your desired password
<username> = your username

You can easely execute that with
Runtime.getRuntime().exec("echo <password> | passwd <username>");

Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: executing UNIX passwd command through Java
 
Similar Threads
Java Applet to execute UNIX passwd command
Display UNIX Commands in TextArea
running a shell script in java
Create Directory through Java
Java