Sponsored Content
Full Discussion: unabel to ssh from script.
Top Forums UNIX for Advanced & Expert Users unabel to ssh from script. Post 302244729 by jsw371 on Wednesday 8th of October 2008 01:31:03 PM
Old 10-08-2008
If I change my shell script from:
$ cat ssh_test.ksh
#!/bin/ksh
ssh -v -v -v remote_server << EOT
date
EOT
if [ $? -ne 0 ]
then
echo failed
exit 1
fi
exit 0


to:

$ cat ssh_test.ksh
#!/bin/ksh
ssh -v -v -v remote_server date
if [ $? -ne 0 ]
then
echo failed
exit 1
fi
exit 0

it works. I was hoping to be able to use the <<EOT....EOT syntax because I want to expand this script to be able to use if statements and several commands. I was hoping not to have to put a script on each remote server. Over 100 remote servers I need to connect to.

Is there something obvious that I am missing?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

ssh in a script

Hi, I am trying to ssh/rlogin onto another box through a script. What is the syntax so I do not get prompted for a password. Thanks in advance (3 Replies)
Discussion started by: mrbnetbar
3 Replies

2. UNIX for Dummies Questions & Answers

apt-get is unabel to find the package

Hi All, I am getting the following error when installing teh package kernel-source-2.6.10 ba-chroot:~# apt-get install kernel-source-2.6.10 Reading Package Lists... Done Building Dependency Tree... Done E: Couldn't find package kernel-source-2.6.10 thanks & Regards Gauri (4 Replies)
Discussion started by: gauri
4 Replies

3. UNIX for Advanced & Expert Users

SSH script

Hello All, I have public keys authentication set up already on my system, to connect to another team's system. What I'm trying to do is to write a script that connects to the customer's box, changes to a certain directory, and then changes the permissions of the files in that directory. ssh... (4 Replies)
Discussion started by: Khoomfire
4 Replies

4. Shell Programming and Scripting

SSH through a script

I want to use ssh through a script without setting key pair in those two machines. I ll take the password as input from user and then run some commands on remote machine. Can someone help me on how to do it (1 Reply)
Discussion started by: vickylife
1 Replies

5. Shell Programming and Scripting

SSH Script

So, right now I'm trying to make an SSH script for my place of employment. This script, I want to go out to the server hostnames we have specified (in another file) and change a users account password. We use Kerberized telnet, so if telnet root hostname fails, I want it to use ssh usernamehostname... (1 Reply)
Discussion started by: nkitmitto
1 Replies

6. UNIX for Advanced & Expert Users

SSH using shell script terminates the script execution

Hello, I am writing a shell script in which i do ssh to remote server and count the number of files there and then exit. After the exit the shell script terminates which i believe is expected behavior. Can some one suggest me a way where even after the exit the script execution resumes. ... (2 Replies)
Discussion started by: manaankit
2 Replies

7. Shell Programming and Scripting

ssh script

I am connecting to a remote server using this ssh command: ssh -p 2222 username@***.***.***.*** I then get a password prompt where I enter the password. I need to make an ssh connection using a script instead of doing it manually. How can I automate the connection process and make the... (2 Replies)
Discussion started by: locoroco
2 Replies

8. Shell Programming and Scripting

script for ssh

The below command executing manually from server01. It will ask the password and retrieves the result(total number of characters in a filename.txt file available in server02) (username@server01)$ ssh username@server02 wc -c /log/filename.txt username@server02's password: 25500... (1 Reply)
Discussion started by: subi.ut
1 Replies

9. Shell Programming and Scripting

SFTP or scp with password in a batch script without using SSH keys and expect script

Dear All, I have a requirement where I have to SFTP or SCP a file in a batch script. Unfortunately, the destination server setup is such that it doesn't allow for shell command line login. So, I am not able to set up SSH keys. My source server is having issues with Expect. So, unable to use... (5 Replies)
Discussion started by: ss112233
5 Replies

10. UNIX for Beginners Questions & Answers

Ssh script to validate ssh connection to multiple serves with status

Hi, I want to validate ssh connection one after one for multiple servers..... password less keys already setup but now i want to validate if ssh is working fine or not... I have .sh script like below and i have servers.txt contains all the list of servers #/bin/bash for host in $(cat... (3 Replies)
Discussion started by: sreeram4
3 Replies
SSH-KEYSIGN(8)						    BSD System Manager's Manual 					    SSH-KEYSIGN(8)

NAME
ssh-keysign -- ssh helper program for host-based authentication SYNOPSIS
ssh-keysign DESCRIPTION
ssh-keysign is used by ssh(1) to access the local host keys and generate the digital signature required during host-based authentication with SSH protocol version 2. ssh-keysign is disabled by default and can only be enabled in the global client configuration file /etc/ssh/ssh_config by setting EnableSSHKeysign to ``yes''. ssh-keysign is not intended to be invoked by the user, but from ssh(1). See ssh(1) and sshd(8) for more information about host-based authen- tication. FILES
/etc/ssh/ssh_config Controls whether ssh-keysign is enabled. /etc/ssh/ssh_host_dsa_key, /etc/ssh/ssh_host_rsa_key These files contain the private parts of the host keys used to generate the digital signature. They should be owned by root, read- able only by root, and not accessible to others. Since they are readable only by root, ssh-keysign must be set-uid root if host- based authentication is used. SEE ALSO
ssh(1), ssh-keygen(1), ssh_config(5), sshd(8) HISTORY
ssh-keysign first appeared in OpenBSD 3.2. AUTHORS
Markus Friedl <markus@openbsd.org> BSD
May 31, 2007 BSD
All times are GMT -4. The time now is 09:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy