Can you describe in as much detail as you can what the network topology of your systems is?
Also, can you confirm which flavour of Unix you are running on each server?
Lastly, can you check if home directories are mounted via nfs or use some other distributed file system?
I'll take this as far as I can and hopefully get enough info to point to the right place to solve this.
We have a setup whereby we cannot login to ServerB directly by using putty.
We have to first login to ServerA by providing username and password and it somehow takes us to serverB and prompts for the password for my login id for ServerB. Providing the password again logs me onto ServerB where I have a script test.sh which I need to execute.
I wanted to automate the execution of script test.sh on ServerB from my local windows machine hence I wrote the below command.
This command logs me onto ServerA but does not take me to ServerB hence test.sh script is not found.
I cannot logon to serverB due to this hopping concept in place.
Kindly help me with some work around.
Note: ServerA and ServerB both are unix servers
This was basically done inorder to disable VPN connectivity from remote locations.
Quote:
Also, can you confirm which flavour of Unix you are running on each server?
Linux ServerA 2.6.18-164.11.1.el5PAE #1 SMP Wed Jan 6 13:43:57 EST 2010 i686 i6
86 i386 GNU/Linux
Don't worry, I think that's enough info for now. Let me have a think about this.
Just two clarifications required...
Do you need to scp the file to ServerB every time or is it only once and it will live on ServerB forever after that?
Can you copy keys from one server to another to set up key-based (passwordless) logins?
I think the answer will involve essentially running a command or script on ServerA to run a command on ServerB.
The file on serverB has to be executable, when you scp the script file to serverB, even if it started out with the executable permission bits set, they will likely be gone on the remote box. Depends on your umask setting on the remote box.
The simple way to handle all this. Use sftp to move the file:
Do not use scp. Now the file is over on serverB and anytime you run it via ssh from serverA it will work for you.
The file on serverB has to be executable, when you scp the script file to serverB, even if it started out with the executable permission bits set, they will likely be gone on the remote box. Depends on your umask setting on the remote box.
The simple way to handle all this. Use sftp to move the file:
Do not use scp. Now the file is over on serverB and anytime you run it via ssh from serverA it will work for you.
The problem is that there is no diect access to ServerB as per the OPs previous post, if this was not the case my first solution would have worked fine.
The problem is that there is no diect access to ServerB as per the OPs previous post, if this was not the case my first solution would have worked fine.
There is 0 work on ServerA. I dont need the scripts or any file on serverA. Its just a HOP server that we are given access to. Login to this server helps auto jump to the actual client machine which is ServerB.
There is no network connection between our windows workstation and serverB. Network Timesout if we try to connect to.
What would I need to run at windows inorder to get the script running on serverB by hopping to it via serverA.
I have a simple straight forward question.
If login to ServerA by putty helps auto jump to serverB with the need of the password to be entered the second time why doesn't or why couldn't plink or any alternate tool do the same ?
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 ----------
Quote:
Originally Posted by spynappels
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
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.
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
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)
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)
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)
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)
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)
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)
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)
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 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 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)