i have multiple server and its reading only 1st ip for rest it is not reading and checking the connection.
If anyone who can be humble and kind enough to guide me on the right direction.
Regards,
Sadique
---------- Post updated at 06:06 AM ---------- Previous update was at 06:01 AM ----------
Thanks Rudic your observation worked for me now with my original code i am able to connect to all the ip with their host and validate the connection.
Also as u suggested i have removed the
Thank you for the help everyone.
Hello all,
I connect usually to one enviornment "dev" daily and then ftp some files to some other enviorment "uat" and then login to "uat" and run some scripts to process these files.
I was thinking to automate the process, where running one script from "dev" will complete all task required... (11 Replies)
Hi,
I am new to Shell Scripting. Can anybody help me in writing a Script Which Could Login from a Unix box to a Remote Unix box which accepts the user credentials automatically and display the result for checking the Disk Space Utilisation (Without running any SSH agent). (1 Reply)
Hi im trying to write a script to logon to list of servers with same userID. I have no option/plan to implement ssh-keygen sharing between the systems, so i have written script creating 2 files,
file1 holds list of hosts
host1
host2
host3
file2 has following script
for i in `cat file1`... (1 Reply)
I have a script on about 15 hosts that I need to run for each host whenever I want (not crontab). Problem is, this script takes 5-10 mins to run for each host. Is there a way I can run the script in parallel for all the hosts instead of 1 at a time? Also, I'm remotely running the script on the... (3 Replies)
Hi There,
I have a file contaning some 100 servers names one by one the file called redhat_servers.txt
I want to prepare a script where it should give me the host name and kernal version.
I wrote like this,
#!/bin/bash
while read line
do
ssh $line "uname -nr"
done <... (3 Replies)
Hi guys - I am having a hard time trying to figure how to search for a certain string on config files hosted on multiple hosts.
This is an example:
Hostnames: myhost1.mycompany.com|myhost2.mycompany.com|myhost3.mycompany.com
String to search for: myipaddress.somehost.com
Directory... (9 Replies)
Hello,
I am trying to login to multiple servers and i have to run multiple loops to gather some details..Could you please help me out.
I am specifically facing issues while running for loops.
I have to run multiple for loops in else condition. but the below code is giving errors in for... (2 Replies)
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)
Hello all,
i'm trying to create a report by greping a pattern on multiple remote hosts and creta a simple report,
actually i did this, is ther any better way to do this.
#!/bin/bash
for host in `cat RemoteHosts`
do
ssh $host -C 'hostname 2>&1; grep ERROR /var/log/WebServer.log.2019-09-21... (0 Replies)
Hi all,
i'm trying to gether multiple pattern on remote hosts, and trying to print hostname and the pattern,
ssh remoteserver1 -C 'hostname 2>&1;cat /var/log/server1.log | awk -F ";" '"'"'{ print " "$2" "$5}'"'"'| sort | uniq -c | sort -g -r '
The output is the following,
remoteserver1
... (8 Replies)
Discussion started by: charli1
8 Replies
LEARN ABOUT CENTOS
libssh2_knownhost_checkp
libssh2_knownhost_check(3) libssh2 manual libssh2_knownhost_check(3)NAME
libssh2_knownhost_checkp - check a host+key against the list of known hosts
SYNOPSIS
#include <libssh2.h>
int libssh2_knownhost_checkp(LIBSSH2_KNOWNHOSTS *hosts,
const char *host, int port,
const char *key, size_t keylen,
int typemask,
struct libssh2_knownhost **knownhost);
DESCRIPTION
Checks a host and its associated key against the collection of known hosts, and returns info back about the (partially) matched entry.
host is a pointer the host name in plain text. The host name can be the IP numerical address of the host or the full name.
port is the port number used by the host (or a negative number to check the generic host). If the port number is given, libssh2 will check
the key for the specific host + port number combination in addition to the plain host name only check.
key is a pointer to the key for the given host.
keylen is the total size in bytes of the key pointed to by the key argument
typemask is a bitmask that specifies format and info about the data passed to this function. Specificly, it details what format the host
name is, what format the key is and what key type it is.
The host name is given as one of the following types: LIBSSH2_KNOWNHOST_TYPE_PLAIN or LIBSSH2_KNOWNHOST_TYPE_CUSTOM.
The key is encoded using one of the following encodings: LIBSSH2_KNOWNHOST_KEYENC_RAW or LIBSSH2_KNOWNHOST_KEYENC_BASE64.
knownhost if set to non-NULL, it must be a pointer to a 'struct libssh2_knownhost' pointer that gets filled in to point to info about a
known host that matches or partially matches.
RETURN VALUE libssh2_knownhost_check(3) returns info about how well the provided host + key pair matched one of the entries in the list of known hosts.
LIBSSH2_KNOWNHOST_CHECK_FAILURE - something prevented the check to be made
LIBSSH2_KNOWNHOST_CHECK_NOTFOUND - no host match was found
LIBSSH2_KNOWNHOST_CHECK_MATCH - hosts and keys match.
LIBSSH2_KNOWNHOST_CHECK_MISMATCH - host was found, but the keys didn't match!
AVAILABILITY
Added in libssh2 1.2.6
EXAMPLE
See the ssh2_exec.c example as provided in the tarball.
SEE ALSO libssh2_knownhost_init(3)libssh2_knownhost_free(3)libssh2_knownhost_add(3)libssh2 1.2.6 1 May 2010 libssh2_knownhost_check(3)