When you connect using PuTTY, are you just putting the details in and connecting, or are you using some saved session?
It could be that the saved session has the hop saved in as a command to execute on login to serverA. If it is a saved session, load it but don't initiate the connection, and go to the SSH Tab/Category. There is an entry there where you can specify a remote command such as that required to ssh from ServerA to ServerB, so you automatically get forwarded from ServerA to ServerB when you login to ServerA using the saved PuTTY profile.
I think you can direct Plink to use the same profiles, but I'm not 100% certain of that. You could look at the PuTTY documentation to see the details. PuTTY User Manual
If this is the case, we just need to figure out how to get the script from the Windows box to ServerB, this could probably be done using 2 separate scp commands within a single script.
---------- Post updated at 09:20 AM ---------- Previous update was at 08:50 AM ----------
I just tested this and if you have a saved session in PuTTY, you can use the same session in plink
If the session name has a space in it, you can put it into double quotes.
I also checked if a saved session has a "ssh user@anotherhost" command saved in the SSH category, it will lok like it directly logs into anotherhost without an internediate shell, and you should just be asked for the password for 'server' first, and then for 'anotherserver'. The good news is this works exactly the same if this session is then used for a plink connection.
Please see if the below helps.
I tried this...
C:\Program Files\PuTTY>plink -v -ssh ms104u@144.160.112.17 ssh ms104u@132.201.72.229
Looking up host "144.160.112.17"
Connecting to 144.160.112.17 port 22
Server version: SSH-2.0-OpenSSH_4.3
We claim version: SSH-2.0-PuTTY_Release_0.60
Using SSH protocol version 2
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-1
Host key fingerprint is:
ssh-rsa 1024 07:ce:4c:e5:dd:57:49:d7:a7:c2:b7:0b:be:f7:0d:f4
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
Initialised HMAC-SHA1 server->client MAC algorithm
Using username "ms104u".
Using keyboard-interactive authentication.
Password:
Access granted
Opened channel for session
Started a shell/command
Pseudo-terminal will not be allocated because stdin is not a terminal.
This system is restricted solely to authorized users for legitimate
business purposes only. The actual or attempted unauthorized access, use, or
modification of this system is strictly prohibited by . Unauthorized
users are subject to Company disciplinary proceedings and/or criminal and
civil penalties under state, federal, or other applicable domestic and
foreign laws. The use of this system may be monitored and recorded for
administrative and security reasons. Anyone accessing this system expressly
consents to such monitoring and is advised that if monitoring reveals
possible evidence of criminal activity, may provide the evidence of
such activity to law enforcement officials. All users must comply with AT&T
company policies regarding the protection of information assets.
IMPORTANT NOTICE: See here for authentication requirements to be enforced:
Permission denied, please try again.
Server sent command exit status 255
Disconnected: All channels closed
Permission denied, please try again.
Received disconnect from 132.201.72.229: 2: Too many authentication failures for
ms104u
where ms104u=user1, 144.160.112.17=ServerA and 132.201.72.229
=ServerB
hi unix guru's
i am new to unix shell programming.
i found a trouble in executing a script(bali.ksh) which is available on serverA with username xyza, this script contains sqlplus command to retrive the data from the database available on other serverC.
Now i need to run the above script... (4 Replies)
Hi All,
I want to execute some commands on unix machine from the mac machne. I have two options for doing so, I am confused which is the best way of doing. Here are two options.
Requirement:
Execute command on the remote server machine. Commands to be executed itself contain arguments to be... (0 Replies)
Hi everyone
I intend to trigger a script from one machine say mc1 that actually excutes on different machine say mc2 and redirect the logs to that machine mc2.
I tried to use nohup <nfs location of machine >/script.sh > <nfs location of machine >/script.log 2>&1 &
nfs location of... (2 Replies)
Hi,
I need to login into remote server and execute a shell script over there.
As of now i am making use of ssh command
ssh primUser@135.254.242.2 sh /poll.sh
I am logging in as primUser but unless i change the user to root the script execution on the remote machine is not possible.
... (5 Replies)
All, I need to write an unix shell script which inserts some records into a file located in remote servers.
* Get the input from the user and insert according the first row. It should be in ascending order.
123451,XA,ABA
123452,XB,ABB
123453,XC,ABC
123455,XE,ABE
123456,XF,ABF
123458,XG,ABG... (2 Replies)
We have a few machines which share the same directory. How can I execute the same script under that directory in different machine while I am using mine? (1 Reply)
Recently, I need to generate a lot of files from a few master files. In fact, if I relogin to the server machine, my operating would be much faster. My question is this: Can I write a script in which the current path can be automatically saved and relogin to the server to execute my command in the... (0 Replies)
Hi All,
We have 2 servers A and B.
B is having a sctipt called b.sh in path /home/dev/scripts.
Now my requirement is i want to execute b.sh from server A.
Kindly help me. (3 Replies)
I want to execute a shell script(set of commands) on remote machine and that script takes input from text file(local machine). Please refer below:
ssh user@hostname 'bash -s'< ./test.sh file.txt
But i got the error file.txt doesn't exist.
Can anyone help me on this.
Content of test.sh:
... (2 Replies)
I have a script in local server
cd /home/dell/work/BOP/testdir
./processchk po (here processchk is a script & po is passed as an argument)
Now I want to execute this script from remote server
ssh $username@$hostname "cd /home/dell/work/BOP/testdir; ./processchk po"
But Its getting error... (9 Replies)