Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

SSH through a java socket connection

  Asked By: Richard    Date: Apr 22    Category: Java    Views: 2474
  

I'm trying to connect to a linux machine through a socket connection
on port 22 and to issue a SSH command to this machine in order to
create a user on this linux machine.

Upon opening the socket, the linux machine returns the version of SSH
(I'm displaying the return code from the DataInputStream returned
from the linux machine), after that, nothing happens!!

After sending the SSH command (ostream.writeBytes("ssh -l root
169.254.0.5 useradd roger -p password"); where ostream is the
DataOutputStream got from the Socket), I send the password for the
root account.

No user is created on the linux machine.

I also tried the eject command with no success.

Note: I'm sure the ssh commands i'm sending are right, because I
tried to send them from another linux machine, and they worked...


Can anyone help?
Can SSH commands be used this way?
I know there's another command called RSH, what port does it use? and
can it also be used for the purposes i stated?

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on SSH through a java socket connection Or get search suggestion and latest updates.




Tagged: