Sponsored Content
Full Discussion: Issue in Variable in SSH
Top Forums Shell Programming and Scripting Issue in Variable in SSH Post 302349374 by balamv on Monday 31st of August 2009 08:51:12 PM
Old 08-31-2009
Issue in Variable in SSH

Friends,
I want to write a script. The logic follows

1. Script starts
2. SSH to Remote Machine and check whether /home/testUser dir is there or not.
3. If it is there, am assigning a value to a variable. else not
4. If the variable is set, the do the copy from remote machine to my local machine using scp.

Here, i can not get the value of the variable in shell script.
For ex,
ssh -q REMOTE_SERVER "if [ -d /home/testUser ]; then FLAG=YES fi"
echo $FLAG

in the above case, i can not able to print the value "YES"

My doubt is can we get the value of the variable that we set inside SSH?
Thanks in advance
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

ssh issue

Im using the default ssh program on a solaris 9 system to connect to another server. When connecting to the other host it make me type my password in 3 to 4 times before letting me in. Is anyone familar with this? (4 Replies)
Discussion started by: meyersp
4 Replies

2. UNIX for Advanced & Expert Users

An issue with SSH

Hey Guys! I got two PCs at my place. In the beginning, one of my PCs had RHEL3( say PC1 ) and one had RHEL4 ( say PC2 ). I was able to ssh from PC1 to PC2 and vice-versa. But recently I've upgraded PC1 from RHEL3 to RHEL4. Now when i am trying to ssh from PC2 to PC1, it is not allowing... (1 Reply)
Discussion started by: chakri.penguin
1 Replies

3. Solaris

ssh issue

I'm having a problem with an ssh server "SSH-2.0-Sun_SSH_1.1.2" on solaris 10. when i do try to connect from windows using puTTY the server refuse's the connection . when i try to connect using telnet from the same windows machine it accepts the connection and i got the following bannar... (32 Replies)
Discussion started by: h@foorsa.biz
32 Replies

4. Shell Programming and Scripting

SSH issue

I want to run a program on remote server by using unauthenticated ssh. It works when I ssh from command line however, it does not work when I try to invoke ssh script with other application. Any clue? (6 Replies)
Discussion started by: sam101
6 Replies

5. Solaris

SSH issue

Facing a SSH issue while creating passwordless login. unix> ./create_ssh In the program, you will be asked and providing 1. SSH private key filename (twice) 2. key passcode (twice) Enter private key filename: id_ss81dev ld.so.1: ssh-keygen: fatal: relocation... (5 Replies)
Discussion started by: flinders1323
5 Replies

6. UNIX for Advanced & Expert Users

ssh issue

Hi I have a annoying situation here . Our non prod server connect to informatica to run the work flow. But since yest some jobs are getting failed due ssh to informatica server been unsuccessfull. please look into this. successful log for job fiusdcacct_ios_price_venld: SSH... (2 Replies)
Discussion started by: ptappeta
2 Replies

7. Fedora

ssh issue

Hello, I have two computers at my desk, let's call them A and B. I have some tasks that can only be performed on one of them and some on the other, so I need to be able to ssh from one to the other and vice versa to transfer files, etc. A can ssh to B without problem: I even copied the public key... (6 Replies)
Discussion started by: Leo_Boon
6 Replies

8. Solaris

SSH issue

Hi guys. I just installed Solaris 10 and want to enable ssh on it So that i can remotely use it from another location. I read a post on this forum an it was written that SSH is enabled by default. I did a ps -ef | grep ssh and nothing showed up meaning that it isnt running. I even tried... (11 Replies)
Discussion started by: Junaid Subhani
11 Replies

9. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

10. UNIX for Advanced & Expert Users

Ssh issue

Hi All, I am trying to connect between two system , I am facing the issue with -SSH-t-l userid systemname exit ( this is the syntax) It suppose to ask for password , but it throws the error as mentioned below Error is received disconnect from system and remote login for the... (1 Reply)
Discussion started by: sudhainit
1 Replies
libssh2_channel_direct_tcpip_ex(3)				  libssh2 manual				libssh2_channel_direct_tcpip_ex(3)

NAME
libssh2_channel_direct_tcpip_ex - Tunnel a TCP connection through an SSH session SYNOPSIS
#include <libssh2.h> LIBSSH2_CHANNEL * libssh2_channel_direct_tcpip_ex(LIBSSH2_SESSION *session, const char *host, int port, const char *shost, int sport); LIBSSH2_CHANNEL * libssh2_channel_direct_tcpip(LIBSSH2_SESSION *session, const char *host, int port); DESCRIPTION
session - Session instance as returned by libssh2_session_init_ex(3) host - Third party host to connect to using the SSH host as a proxy. port - Port on third party host to connect to. shost - Host to tell the SSH server the connection originated on. sport - Port to tell the SSH server the connection originated from. Tunnel a TCP/IP connection through the SSH transport via the remote host to a third party. Communication from the client to the SSH server remains encrypted, communication from the server to the 3rd party host travels in cleartext. RETURN VALUE
Pointer to a newly allocated LIBSSH2_CHANNEL instance, or NULL on errors. ERRORS
LIBSSH2_ERROR_ALLOC - An internal memory allocation call failed. SEE ALSO
libssh2_session_init_ex(3) libssh2 0.15 1 Jun 2007 libssh2_channel_direct_tcpip_ex(3)
All times are GMT -4. The time now is 06:09 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy