Total nube to jws, need to run ssh command via web or jws?

Ok So we had a developer that created this application that can basically run ssh commands via jws I believe. Unfortunately he is no longer here. I am wondering how you do this? I know tha commands that are already set up, but I have no idea how to implement it into my project.
I am using Struts 2, Java 5, Weblogic 9.2, Spring
Thanks
orozcom

Have a look at:
http://www.jcraft.com/jsch/
basically you'd need a small webstart client to wrap something like the above library. Best thing is to try with a standalone java client first. Once that is working have a look at turning it into a webstart app.

Similar Messages

  • Running ssh command from java and then answering password prompt

    Hi,
    I have a situation that has not solved yet. I am running ssh command from unix terminal without any problem, and then i enter password.
    For example :
    [oracle@fuata]:/export/home/oracle> ssh -N [email protected] -L 9901:127.0.0.1:9999
    Password:
    It is working. I have question that how can i perform this in java? I am thinking that i can run ssh command by using Runtime Class, it is ok. But how can i answer the password? I am a bit confused. Is there any example looks like this?
    Thanks for responses.

    futi wrote:
    Thanx. Firstly i insisted to do this without jsch but actually this is harder than jsch. I edit some of code pieces PortForwardingL.java and could run it. It works problem-free. Could you say why you "insisted" on this approach. It can't be for speed+ since jsch is very fast. It can't be for portability+ since jsch is portable but the use of Runtime.exec() requires the installation of ssh software. It can't be because of limitations+ since jsch is a fully featured library. It can't be for security+ since jsch is secure. It can't be for ease of use+ since jsch is much easier to use than ssh with Runtime.exec(). Unless it's a licensing issue, it can't be for commercial+ reasons since jsch is free. The only reason I can think of why one would "insisted" on this approach is if it is for some college project.

  • Need to run two commands in Runtime.getRuntime.exec()???

    I need to run two commands in the same shell , in the same exec function... is this possible? I tried to invoke
    ksh -e ... command1;command2
    but that did nothing

    I need to run two commands in the same shell , in the
    same exec function... is this possible? I tried to
    invoke
    ksh -e ... command1;command2
    but that did nothingI'm not all that familiar with that particular shell (ksh), but if it works from the command-line, I'd venture to guess that it would have worked there as well. My guess is it did "work" (executed the 2 commands) but that you may have misdiagnosed the real problem (current working directory assumption incorrect, etc).

  • Running ssh command in a java application

    Hi there!
    I am trying to run a ssh command from a java application cause I need to store the result.
    Actually I can run this command in the cygwin shell so I need to open the shell and run the command, all trough java.
    so, what my process needs to do is:
    1) open the cmd
    2) run C:\cygwin\cygwin.bat
    3) execute the ssh command
    ssh -l fip-user ipdb fip 42704) print the result of the ssh command.
    Note that the cygwin opens in the same command line window and so will print it's result to the same process inputstream
    Message was edited by:
    RBervini

    Use "Runtime.getRuntime().exec()" to execute the SSH program,
    and you can then get the output of the SSH program
    via the getInputStream() method on the returned Process object.
    Note: there are many pitfalls with this. In particular, most people don't know
    they should create separate threads to drain the input/output pipes.
    See this excellent classic article http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    on how to do it right.

  • Run ssh command in labview

    does anyone knows how to run an ssh command in labview?
    I know how to run some linux commands in labview but my problem is when I try to run an ssh command ...
    thks
    JP

    Unfortunetly, I don't know how to script in a password for ssh. SSH closes the stdin and re-opens the tty that you are logged in at. This is actually a security feature. As well as a way to send stdin to remote programs (otherwise your password would get in the way.)
    If you don't need to ssh to a remote host, and you want to chmod something on the localhost, you could use sudo instead. With sudo you can specify certain users (or all users) to run certain commands. (so you could make a shell script to chmod for you).
    I don't know your exact needs, but I think that a public/private keypair could still work. In your authorized keys file on your "root" account, you can even specify that "this public key does not get shell access, and can only execu
    te this one command." This would probably be the most secure method. But it requires the user to have the correct private key as well.
    If you know that won't work for some reason, then maybe you could setup a inetd process that will execute a command whenever someone connects to a certain port (then you could use LabVIEW's TCP VIs).
    Or, if you are not connecting remotely, you could setuid your LabVIEW executable (A VERY BAD IDEA!).
    Also, it is possible to script "telnet." It would of course transmit your root password as plaintext, but trying to script your ssh session would also embed your password in your LabVIEW VI. Out internet toolkit for LabVIEW has some helpful telnet VIs.
    May I ask why you want to chmod something on a remote system that requires root? Sounds like maybe you should create a LabVIEW application on the remote side that acts as a daemon (running as root) and accepts connections and commands and does the chmodding for you.
    -Duffey

  • Running Unix Command from WEB-APPLICATION

    Hi all,
    I want to run unix command from a java-based web application. the basic code part is this ---
    public class RunCommand
          public String runIt()
              String s = null, returnString = "";
              Process p=null;
              try
                       Runtime rt = Runtime.getRuntime();
                  p = rt.exec("sh testPOC.ksh");
                  p.waitFor();
                  BufferedReader stdInput = new BufferedReader(new
                       InputStreamReader(p.getInputStream()));
                  BufferedReader stdError = new BufferedReader(new
                       InputStreamReader(p.getErrorStream()));
                  // read the output from the command
                  returnString += "Here is the standard output of the command:<br>";
                  while ((s = stdInput.readLine()) != null) {
                      returnString += s;
                  // read any errors from the attempted command
                  returnString += "Here is the standard error of the command (if any): <br>";
                  while ((s = stdError.readLine()) != null) {
                      returnString += s;
              catch (IOException e)
                  returnString += "exception happened - here's what I know: ";
                  returnString += "error-> " + e.getMessage();
              catch(Exception e)
                returnString += "exception happened - here's what I know: ";
                  returnString += "error-> " + e.getMessage();
              return returnString;
      }this class is kept as an inner class. The control comes to its outer class, from servlet, from which the runit() is called. but the exception is occuring at line of p=rt.exec(.....). it tells "<command name> : not found transaction completed" [got this using getMessage() method].
    i am unable to show(and see, too) the stacktrace, because i don't have access to that test environment and its log. i can't run this in local because its windows one.
    now can anyone tell me, where is the problem. is there any limitation in web application server/container? this was successful when i used command prompt writing a .java file. Please help me. Thanks in advance...

    Friends, i've got, where the problem is.
    when we run a class file directly from a command prompt, we get an environment with that shell window. but for a servlet application running these kind of commands from a class creates kind of child processes. each and every command is executed as a child process of jvm and don't get those environment. we have 'PATH' variable in the environment. when a command (say, 'dir' or 'sh' or 'ls', etc.) is executed, the shell first search for that executable file (i.e. dir / sh / ls) in the given paths in the variable 'PATH'. this is not available for the child commands of jvm. hence the basic commands are searched in the current directory of the jvm and they are failed.
    i solved the problem giving full path of the commands. like :
    p = rt.exec("/bin/sh runningScript.ksh")

  • Running SSH command after auth

    To save some time, I know about sshrc...
    What I am trying to do is run a script (or file or whatever) after a user is authenticated... This is extremely simple with the use of sshrc, but my users are going to be connecting with the -N argument:
    -N     Do not execute a remote command.  This is useful for just forwarding ports (protocol version 2 only).
    When users are connecting with that, my script does not run...
    Is there an alternate way to run a script?
    By the way... The reason I'm doing this is because I am running a SOCKS server and the users are set to /bin/false.

    Well I am trying to run a script after ssh authentication when the client is connecting with the -N flag....
    I am hosting a socks proxy server, and I want to prevent simultaneous logins with the same user. The proxy users all have the shell set to /bin/false and their default group set to 'proxy '.
    Basically, what I want to do is to disconnect both connections when I detect simultaneous logins...

  • What are the permissions needed to run explain plans via sql develeper?

    Are the permissions the same in Sql Developer to run explain plans like they are when you run them via sql*plus?

    Yes same permission because the explain plan does not tie to the tools.

  • Runtime.exec() I need to run a command prompt command from java.

    the code i have that doesn't seem to work is:
    String driveloc = System.getProperty("user.dir").substring( 0, 1 );
            String path = jTextFieldPath.getText();
            String path2 = jTextFieldPath.getText().substring(0, jTextFieldPath.getText().length()-3) + "lst";
            String[] cmd = { "cmd.exe", "/" + driveloc, "ASMtools\\AS11 " + path + " -L >" + path2};
            txt_mf.append( cmd[3] );
            try {
                Process np = Runtime.getRuntime().exec( cmd );
            catch( java.io.IOException ioe) {
                //error
            }jTextFieldPath.getText() contains the path of the file saved by my program.
    the line of code i am trying to run is:
    AS11 FILE1 -L FILE2this line compiles the asm file and converts it to a lst creating an s19 file in the process. AS11 is an exe that aids the command prompt much like javac.
    If you could help me figure this out it would be great.
    Thanks in advance,
    -Juke

    String driveloc =
    System.getProperty("user.dir").substring( 0, 1 );
    String[] cmd = { "cmd.exe", "/" + driveloc,
      "ASMtools\\AS11 " + path + " -L >" + path2};Are you sure you want to invoke cmd.exe with the switch /c or /d or whatever depending on System.getProperty("user.dir") ?
    Starts a new instance of the Windows 2000 command interpreter
    CMD [A | /U] [Q] [D] [E:ON | /E:OFF] [F:ON | /F:OFF] [V:ON | /V:OFF]
        [[S] [C | /K] string]
    /C      Carries out the command specified by string and then terminates
    /K      Carries out the command specified by string but remains
    /S      Modifies the treatment of string after /C or /K (see below)
    /Q      Turns echo off
    /D      Disable execution of AutoRun commands from registry (see below)
    /A      Causes the output of internal commands to a pipe or file to be ANSI
    /U      Causes the output of internal commands to a pipe or file to be
            Unicode
    /T:fg   Sets the foreground/background colors (see COLOR /? for more info)
    /E:ON   Enable command extensions (see below)
    /E:OFF  Disable command extensions (see below)
    /F:ON   Enable file and directory name completion characters (see below)
    /F:OFF  Disable file and directory name completion characters (see below)
    /V:ON   Enable delayed environment variable expansion using c as the
            delimiter. For example, /V:ON would allow !var! to expand the
            variable var at execution time.  The var syntax expands variables
            at input time, which is quite a different thing when inside of a FOR
            loop.
    /V:OFF  Disable delayed environment expansion.

  • Need to run netsh command with elevated previledges

    Hi Team,
    I am running an script with netsh command for to enable file & print sharing module and that to only for an domain profile.
    But when i try to call this command through VB script, it asks me to run that in elevated previledges.
    PLease help me how do i achieve that, or is there any feasibility to invoke same in bat file itself, please let me know.
    Regards,
    Deepak Sharma.

    Here are couple of URL that might help you : 
    http://stackoverflow.com/questions/17466681/how-to-run-vbs-as-administrator-from-vbs
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/310e57f9-2367-4293-9f97-53d0e077aacc/vb-script-to-run-a-batch-script-as-admin?forum=ITCG
    http://www.server-world.info/en/note?os=Other&p=vbs
    Arnav Sharma | http://arnavsharma.net/ Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading
    the thread.

  • How to create script that run sudo-command, via automator?

    Hi
    I'd want to create script to automate one command I need quite often. I just can't get this to work.
    I'm not using english OS, but I think this is what I do. In automator I choose Utilities -> Run script
    Here's the script I try to run:
    sudo "/Library/Application Support/VMware Fusion/boot.sh --restart"
    I found some tip to do it like this:
    do shell script "sudo /Library/Application Support/VMware Fusion/boot.sh --restart password "pass" with administrator privileges
    Where pass is my admin password.
    This does not work, either.
    Could anybody help me on this?
    Thanks...
    Tomi Toivonen
    Message was edited by: Tomi

    This is not working. What's wrong?
    What's wrong is that the '--restart' is a parameter for boot.sh, and therefore needs to be included within the quotes.
    Additionally, the shell uses spaces to divide parameters, so the spaces in the command will make it appear as multiple commands - '/Library/Application', 'Support/VMware' and 'Fusion/boot.sh'. You need to escape them using a backslash:
    <pre class=command>do shell script "/Library/Application\ Support/VMware\ Fusion/boot.sh --restart" password "pass" with administrator privileges</pre>
    If it's outside of the quotes it would be interpreted as a parameter to 'do shell script' and it won't know what to do with that.

  • Running client scanner via web app

    Hi all, I want to add scanning feature for my web application, I wnat it to be able to run the scanner which attached to client machine, I have got a free twain implementation but it detects the server scanner drivers not clinet.
    any help please.
    thanks. Ahmad Elsafty

    You can't sue the clients scanner from the server side. You need something which executes code on the client.
    Kaj

  • Running interactive commands via WFA

    So I am using WFA to deploy my storage systems. For tasks, where there is no commands I am using InvokeWFACluster-CLI.The problem with this is there are some commands that needs a input like the following --security login create -username <username> -application ontapi -authmethod password -role admin -vserver <admin_vservername>--  Is there a way I can provide the password without requiring the user input. In this case, WFA doesn't prompt for a user input either. Thanks,-Prasad

    prasadkm0204,      You need to look to solve the problem of NO WFA Provided commands in the following order: 1. Look for a Posh cmdlet and create your own WFA commands using those. This will almost certianly solve your problem. Powershell cmdlets for almost everything that is possible to do with a cluster/array is provided. See the documentation on this at WFA->Help->Support Links -> Powershell cmdlets Help. See my code example provided here for the specific case of creating a security login account: WFA Input Type of 'password' issues 2.  If at all there is no Powershell cmdlet available for a task, you can create WFA commands using SDK and ZAPIs. They are bundled for Posh and Perl languages.  3. Invoking direct InvokeWfaCluster-CLI is okay but not what I would recommend to use. Not that this will not work, or will create any unwanted issues. It will be fine mostly excapt it may end up askign for User-Inputs. Also the command output unlike ZAPI or Posh cmdlets is returned in string format  and those are compatively difficult to parse and loop through or be useful in creating advanced level commands.  One liners its fine. You'll start to face this as you develope more commands. sinhaa  

  • How do I tell unix to run a command via AppleScript?

    I have an AppleScript within which I want to start a job running on a remote linux box. Previously in these forums someone helped me do this using the line:
    tell application "Terminal" to do script ("rsh Linux_box -l Myuserid scripttorun")
    however, this creates a Terminal window that hangs around that I'd rather not have there at all. From within the script, can I just tell the underlying unix system to directly run the rsh command without going through a Terminal?
    Thanks.

    Don't tell Terminal, use do shell script:
    do shell script "rsh Linux_box -l Myuserid scripttorun"

  • SSH user, via Open Directory, can't SUDO...

    On three of my Xserves I have SSH access restricted to a handful of users and these users are Open Directory-based users. Aside from the fact that these users don't have a home directory on the servers they connect to (as they're not local users to those machines), I'm having an issue where, when they try and run a command via SUDO, they get an error stating they are not in the sudoers file and thus can't complete the command.
    I'm wondering if anyone has a solution for this? Should I not be using OD-based users for SSH?
    Thanks,
    Kristin.

    Sure, you can use OD-based users and sudo.
    Maybe add your users to the domain's Administrators group, which, by default, would grant sudo on the member machines. Careful, though, as that's the _domain_ administration group. If you need to restrict access so they can't make domain admin level changes but so they can do just about anything on your member servers and workstations, you could just create a new sudo group, maybe called "sudo-admins" then append an appropriate line to the sudoers files on all of your machines... maybe a line that reads:
    %sudo-admins  ALL=(ALL) ALL
    (standard warning about using caution while editing sudoers goes here -- be careful)

Maybe you are looking for

  • DW CS5 bugs seen

    System specs Mac pro Early 2009 2.66 mhz 12 gigs ddr3 Osx 10.6.3 I don't know if anyone else has seen any of these issues, so i will post them in hopes that there may be a fix. Downloaded creative suite cs5 for mac (trial) Installed Photoshop/Dreamwe

  • IC Reconciliation AP/AR Open Items (Prozess 003) with SAP ERP

    Dear All Does anyone has implemented the IC Reconciliation AP/AR Open Items (Prozess 003) with SAP ERP and SAP ByD allready? If yes - is there a standard like RFC within SAP ERP? Or how did you set it up? Thank you and regards Markus

  • Can I create a non-Unicode database manually via create database segment

    Hi As unicode encode use more bytes than 2-bytes encode (for instance, ZHS16GBK), and XE has the limit with 4GB totally. So, can I create a non-Unicode (for instance, ZHS16GBK) database manually via create database segment? or I just could use unicod

  • Ignore auto logoff from specific ABAP program

    The system parameter gui_auto_logout makes sure that GUI-sessions that are not used for some time are automatically logged off. We are working with barcode-handterminals via SAPconsole. For these SAPConsole users I do not want the autologoff. The ter

  • My home button doesnt work; any suggestions?

    I got my ipod in November, well it worked just great til one day the home button just stopped working, it wasnt from a drop; it just stopped. ive restored reset charged my ipod. nothing helped. any suggestions? please and thankyou.