ssh on system


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ssh on system
# 1  
Old 02-04-2009
ssh on system

hello

i am using sshpass to pass the password when trying to ssh to another system with script

it works like that
sshpass -p 'm7843jdf' ssh -o StrictHostKeyChecking=no serverXY

the problem i wants to run application commands after i login like the following

cd /opt/monitor/roco
connect
./show models | wc -l
disconnect

and then grep the output in a file localy

how to do so ?
# 2  
Old 02-04-2009
Seems to work okay:

Code:
sshpass -p 'm7843jdf' ssh -o StrictHostKeyChecking=no serverXY " command; command2; command3" | grep whatever > here.txt

# 3  
Old 02-09-2009
Quote:
Originally Posted by quirkasaurus
Seems to work okay:

Code:
sshpass -p 'm7843jdf' ssh -o StrictHostKeyChecking=no serverXY " command; command2; command3" | grep whatever > here.txt

hello

i have tried above the problem when excute the command on the remote server it retrun error
Error: variable CLISESSID not set

it looks like the command should be excuted correct on the server or ssh options need to be modified
# 4  
Old 02-09-2009
Looks like you need to have your first command be to change your environment variable(s)

Last edited by avronius; 02-09-2009 at 05:11 PM.. Reason: spelling error
# 5  
Old 02-09-2009
Quote:
Originally Posted by avronius
Looks like you need to have your first command be to change your environment variable(s)
how to do so ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. BSD

Can't establish outbound ssh connection on an OpenBSD system

I am getting the below error when I try to make outbound ssh from an OpenBSD system. I can't ssh to any host except the localhost. I can ping the hosts which I can't ssh, though.~ uname -rs OpenBSD 6.1 ~ ssh -V OpenSSH_7.5, LibreSSL 2.5.2 ~ ssh hostname ssh: connect to host hostname... (11 Replies)
Discussion started by: milhan
11 Replies

2. Shell Programming and Scripting

ssh sending local variable to remote system

I am running a useradd script, which works locally but I want to take some of that local information and send it to a remote system, ssh keys are set up between the two systems. I am attaching the script, look at the section titled "Sending information to FTP2" Removed attachment, added... (0 Replies)
Discussion started by: slufoot80
0 Replies

3. Shell Programming and Scripting

how do i avoid system hang due to ssh in script?

I have a script that collects data from about 200 servers using 'ssh'. The problem is that, process sometime hangs at some point stopping the execution of the script. Please give me some idea how can I force the execution to jump to the next step if there arises any problem !! Thanks for replies if... (1 Reply)
Discussion started by: mdangol
1 Replies

4. Shell Programming and Scripting

Regarding ssh into remote system

How can i ssh into a remote system using ssh command in a shell script with password? I havent used password less authentication for the remote system. Thanks and Regards, Rupaa (4 Replies)
Discussion started by: Rupaa
4 Replies

5. Shell Programming and Scripting

Executing a script on a remote system via SSH

Hello all, I have a relatively simple script I wrote to generate a count of errors broken down. What I would like to do is execute this script from another server so that I don't actually have to log in to the server to run the check. The script on what we'll call "Server A" is: ... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

6. Shell Programming and Scripting

ssh script for connecting unix system.

Hi All, I've a log file call netbackup.log in all the 5 servers in location usr/netbackup.log. I dont want to login in each server and check the log file. So i wanted to have a script written to have the log information at one place. I want to have the last 2 lines from the file... (2 Replies)
Discussion started by: suri.tyson
2 Replies

7. Linux

ssh package for IRIX 5.3 Operating System....???

Hi Friends, I would like to install ssh on IRIX 5.3 OS. Can someone help me out for finding the free ssh (Open ssh) package for IRIX 5.3 operating system & also the installation + configuration procedure. Thanks & Regards, jumadhiya. (8 Replies)
Discussion started by: jumadhiya
8 Replies

8. Solaris

Secure FTP Problem using Sun SSH on Client system F-Secure on Server system

I am using shell script to do secure ftp. I have done key file setup to do password less authentication. Following are the FTP Details: FTP Client has Sun SSH. FTP Server has F-Secure. I am using SCP Command to do secure copy files. When I am doing this, I am getting the foll error scp:... (2 Replies)
Discussion started by: ftpguy
2 Replies

9. Shell Programming and Scripting

Perl system ssh find question

I have the following perl code that I use to run backups on remote machines. No problems here, the code works without problems system "ssh", $SHORT_NAME, "cd /;", "sudo", "tar", "cvf", "-", "--exclude=/dev", "--exclude=/proc", "/|", "netcat", "-w2", "troll", "2011" ; The code is used for full... (3 Replies)
Discussion started by: thumper
3 Replies

10. Shell Programming and Scripting

Running ssh on a remote system?

I need to install ypbind and yp-tools on over two-hundred remote client machines based on their redhat version. I have a centralized server on which I created an ssh public key. I then transfered the ssh public key to the authorized_keys file on all the remote hosts; therefore, I can login without... (1 Reply)
Discussion started by: cstovall
1 Replies
Login or Register to Ask a Question