Sponsored Content
Top Forums UNIX for Advanced & Expert Users How to check or remove IP address from a hashed known_hosts file?which Post 302901723 by hce on Thursday 15th of May 2014 08:01:32 AM
Old 05-15-2014
Quote:
Originally Posted by SriniShoo
Change the ip in ip='186.192.10.122' in the below code to check if the IP is available
Code:
 
awk '$0 ~ ip {print ip " exists in " FILENAME}' ip='186.192.10.122' known_hosts

Thanks for the response, but that won't work as I said the known_hosts is not a plain text, it has been hashed by ssh-keygen.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

how to remove a logical ip address?

hi, i "accidentedly" added some logical ip address to my solaris 8 machine. now i want to remove them. i already man ifconfig but some how i just keep getting the wrong syntax. this is the command i used to add ifconfig hme0 addif 192.168.100.10 netmask 255.255.2550.0 up so, now... (2 Replies)
Discussion started by: champion
2 Replies

2. Programming

parsing a string to check if it's an IP address

Hello everybody! I woul quickly need a function bool ParseIPString(char*) that parses a string to check if it's in IP format. thanks in advance for any help! best regards, nadiamihu (1 Reply)
Discussion started by: nadiamihu
1 Replies

3. Shell Programming and Scripting

check if argument is an ip address in bash/sh

Hi all, Can you please suggest a few lines of if statement to check if a variable is an ip address purely in bash/sh? Thanks, Marc (3 Replies)
Discussion started by: marcpascual
3 Replies

4. Shell Programming and Scripting

Check file size and remove files

Hi, Here we have a situation where we have to check the file size and if the file size is greater than 0 bytes then remove the files from the directory. 1)EdwTrxn 2)EdwPost 3)EdwTndr 4)EdwSls 5)EdwSlsRej 6)EdwTndrRej Files will be created in the directory in the following manner. ... (5 Replies)
Discussion started by: srivsn
5 Replies

5. Shell Programming and Scripting

Need to remove lines that start with an IP address

Hi, I keep having to remove lines have an IP address as the second field from my awstats logs, as it makes the processing fail. Rather than do it individually each time (once or twice a week) it fails, I'd like to remove any lines from the file that have 3 digits and then a dot as the start... (1 Reply)
Discussion started by: sfisk
1 Replies

6. UNIX for Dummies Questions & Answers

hashed commands

How to display hashed commands for your current shell session? Thanks. (1 Reply)
Discussion started by: zhshqzyc
1 Replies

7. AIX

known_hosts passwordless access

Dears i have one primary server and 4 secondary server i need to access all my secondary servers from the primary server without using the password how do i configure the known_hosts to do this . (1 Reply)
Discussion started by: thecobra151
1 Replies

8. UNIX for Dummies Questions & Answers

Solaris and known_hosts

Hello, I have a file known_hosts where i want to remove a key, but i don't how to do remove a client on it ? Can you help me please ? Thanks very much (1 Reply)
Discussion started by: jose2204
1 Replies

9. Shell Programming and Scripting

To check the file and remove header before copying

Hi Guys, I have below directory where there are certain files. Something like below country_dir aus_01.txt nz_01.txt aus_02.txt bd.txt property.txt aus nz bd I need to remove the header of the file which ends with _01.txt while copying from country directory to another... (15 Replies)
Discussion started by: rohit_shinez
15 Replies

10. UNIX for Beginners Questions & Answers

Deleted known_hosts file on private server, how do I get it back?

In my ignorance I deleted the known_hosts file on private server. I am not sure what the file type is supposed to be. In general, I have been having problems with ssh and passwords. For some reason, despite having generated a private/public key pair and successfully saving the .pub file onto the... (2 Replies)
Discussion started by: Circuits
2 Replies
SSHFP(1)							  Internet / DNS							  SSHFP(1)

NAME
sshfp - Generate SSHFP DNS records from knownhosts files or ssh-keyscan SYNTAX
sshfp [-k <knownhosts_file>] [-d] [-a] | [<host1> [host2 ...]] sshfp -s [-p <port>] [-d] <-a> [-n <nameserver>] <domain1> [domain2] | <host1> [host2 ...] > DESCRIPTION
sshfp generates RFC4255 SSHFP DNS records based on the public keys stored in a known_hosts file, which implies the user has previously trusted this key, or public keys can be obtained by using ssh-keyscan (1). Using ssh-keyscan (1) implies a secure path to connect to the hosts being scanned. It also implies a trust in the DNS to obtain the IP address of the hostname to be scanned. If the nameserver of the domain allows zone tranfers (AXFR), an entire domain can be processed for all its A records. OPTIONS
-s / --scan <hostname1> [hostname2 ...] Scan hosts or domain for public SSH keys using ssh-keyscan -k / --knownhosts <knownhosts_file> <hostname1> [hostname2 ...] Obtain public SSH keys from a known_hosts file. Defaults to using ~/.ssh/known_hosts -a / --all Scan all hosts in the known_hosts file when used with -k. When used with -s, it will attempt an zone transfer (AXFR) to obtain all A records in the domain specified. -d / --trailing-dot Add a trailing dot to the hostname in the SSHFP records. It is not possible to determine whether a known_hosts or dns query is for a FQDN (eg www.xelerance.com) or not (eg www) or not (unless -d domainname -a is used, in which case a trailing dot is always appended). Non-FQDN get their domainname appended through /etc/resolv.conf These non-FQDN will happen when using a non-FQDN (eg sshfp -k www) or known_hosts entries obtained by running ssh www.sub where .domain.com is implied. When -d is used, all hostnames not ending with a dot, that at least contain two parts in their hostname (eg www.sub but not www get a trailing dot. Note that the output of sshfp can also just be manually editted for trailing dots. -o / --output <filename> Write to filename instead of stdout -p / --port <portnumber> Use portnumber for scanning. Note that portnumbers do NOT appear in SSHFP records. -h / --help Output help information and exit. -v / --version Output version information and exit. -q / --quiet Output less miscellany to stderr FILES
~/.ssh/known_hosts REQUIREMENTS
sshfp requires python-dns (http://www.pythondns.org) Fedora: yum install python-dns Debian: apt-get install python-dnspython BUGS
if a domain contains non-working glue A records, then ssh-keyscan aborts instead of skipping the single broken entry. This program can look up hashed hostnames in a known_hosts file if a recent-enough ssh-keygen is present EXAMPLES
typical usage: sshfp (implies -k -a) sshfp -a -d (implies -k) sshfp -k bofh.xelerance.com (from known_hosts) sshfp -s bofh.xelerance.com (from a scan to the host) sshfp -k ~paul/.ssh/known_hosts bofh.xelerance.com www.openswan.org -o /tmp/mysshfp.txt sshfp -a -d -d xelerance.com -n ns0.xelerance.net >> /var/named/primary/xelerance.com SEE ALSO
ssh-keyscan(1) ssh(1) and RFC-4255 http://www.xelerance.com/software/sshfp/ http://lists.xelerance.com/mailman/listinfo/sshfp/ AUTHORS
Paul Wouters <paul@xelerance.com>, Jacob Appelbaum <jacob@appelbaum.net>, James Brown <jbrown@yelp.com> COPYRIGHT
Copyright 2006-2010 Xelerance Corporation This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License (file COPYING in the distribution) for more details. Paul Wouters April 12, 2011 SSHFP(1)
All times are GMT -4. The time now is 01:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy