Equivalent of “ssh-keyscan -H” in Solaris 10/11

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I'm creating a Perl program that adds the specified host in root's known_hosts file. The program works in AIX and Linux, but not in Solaris and sadly, I can't find its equivalent command.



Sample line:



system("ssh-keyscan -H www.myserver.domain >> /.ssh/known_hosts");


Output:




ssh-keyscan: illegal option -- H
Usage: ssh-keyscan [-v46] [-p port] [-T timeout] [-f file]
[host | addrlist namelist] [...]




Update 1:



I tried the following command but it still asks for authenticity:



system("ssh-keyscan -t rsa www.myserver.domain >> /.ssh/known_hosts");


Update 2:
Output outside Perl:



# ssh-keyscan -t rsa www.myserver.domain >> /.ssh/test123.text 
# www.myserver.domain SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3
# less test123.text
# www.myserver.domain ssh-rsa KEY
# ssh www.myserver.domain
# The authenticity of host 'www.myserver.domain (IP)' can't be established. RSA key fingerprint is FINGERPRINT. Are you sure you want to continue connecting (yes/no)?









share|improve this question























  • What's the version of ssh-keyscan you're using on Solaris?
    – slm♦
    Aug 15 at 2:12










  • How do I find out the version of ssh-keyscan?
    – Shan
    Aug 15 at 2:19










  • Can't tell, doesn't appear to display a version.
    – slm♦
    Aug 15 at 2:21










  • If you are root (as appears) and your homedir is in fact the rootdir, look at /.ssh/known_hosts and make sure a line for the desired host is in there, then try ssh -v $hostname and look at the logged output.
    – dave_thompson_085
    Aug 15 at 6:23














up vote
1
down vote

favorite












I'm creating a Perl program that adds the specified host in root's known_hosts file. The program works in AIX and Linux, but not in Solaris and sadly, I can't find its equivalent command.



Sample line:



system("ssh-keyscan -H www.myserver.domain >> /.ssh/known_hosts");


Output:




ssh-keyscan: illegal option -- H
Usage: ssh-keyscan [-v46] [-p port] [-T timeout] [-f file]
[host | addrlist namelist] [...]




Update 1:



I tried the following command but it still asks for authenticity:



system("ssh-keyscan -t rsa www.myserver.domain >> /.ssh/known_hosts");


Update 2:
Output outside Perl:



# ssh-keyscan -t rsa www.myserver.domain >> /.ssh/test123.text 
# www.myserver.domain SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3
# less test123.text
# www.myserver.domain ssh-rsa KEY
# ssh www.myserver.domain
# The authenticity of host 'www.myserver.domain (IP)' can't be established. RSA key fingerprint is FINGERPRINT. Are you sure you want to continue connecting (yes/no)?









share|improve this question























  • What's the version of ssh-keyscan you're using on Solaris?
    – slm♦
    Aug 15 at 2:12










  • How do I find out the version of ssh-keyscan?
    – Shan
    Aug 15 at 2:19










  • Can't tell, doesn't appear to display a version.
    – slm♦
    Aug 15 at 2:21










  • If you are root (as appears) and your homedir is in fact the rootdir, look at /.ssh/known_hosts and make sure a line for the desired host is in there, then try ssh -v $hostname and look at the logged output.
    – dave_thompson_085
    Aug 15 at 6:23












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I'm creating a Perl program that adds the specified host in root's known_hosts file. The program works in AIX and Linux, but not in Solaris and sadly, I can't find its equivalent command.



Sample line:



system("ssh-keyscan -H www.myserver.domain >> /.ssh/known_hosts");


Output:




ssh-keyscan: illegal option -- H
Usage: ssh-keyscan [-v46] [-p port] [-T timeout] [-f file]
[host | addrlist namelist] [...]




Update 1:



I tried the following command but it still asks for authenticity:



system("ssh-keyscan -t rsa www.myserver.domain >> /.ssh/known_hosts");


Update 2:
Output outside Perl:



# ssh-keyscan -t rsa www.myserver.domain >> /.ssh/test123.text 
# www.myserver.domain SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3
# less test123.text
# www.myserver.domain ssh-rsa KEY
# ssh www.myserver.domain
# The authenticity of host 'www.myserver.domain (IP)' can't be established. RSA key fingerprint is FINGERPRINT. Are you sure you want to continue connecting (yes/no)?









share|improve this question















I'm creating a Perl program that adds the specified host in root's known_hosts file. The program works in AIX and Linux, but not in Solaris and sadly, I can't find its equivalent command.



Sample line:



system("ssh-keyscan -H www.myserver.domain >> /.ssh/known_hosts");


Output:




ssh-keyscan: illegal option -- H
Usage: ssh-keyscan [-v46] [-p port] [-T timeout] [-f file]
[host | addrlist namelist] [...]




Update 1:



I tried the following command but it still asks for authenticity:



system("ssh-keyscan -t rsa www.myserver.domain >> /.ssh/known_hosts");


Update 2:
Output outside Perl:



# ssh-keyscan -t rsa www.myserver.domain >> /.ssh/test123.text 
# www.myserver.domain SSH-2.0-OpenSSH_6.7p1 Debian-5+deb8u3
# less test123.text
# www.myserver.domain ssh-rsa KEY
# ssh www.myserver.domain
# The authenticity of host 'www.myserver.domain (IP)' can't be established. RSA key fingerprint is FINGERPRINT. Are you sure you want to continue connecting (yes/no)?






perl solaris






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 7 at 10:05









Rui F Ribeiro

36.6k1271116




36.6k1271116










asked Aug 15 at 2:11









Shan

63




63











  • What's the version of ssh-keyscan you're using on Solaris?
    – slm♦
    Aug 15 at 2:12










  • How do I find out the version of ssh-keyscan?
    – Shan
    Aug 15 at 2:19










  • Can't tell, doesn't appear to display a version.
    – slm♦
    Aug 15 at 2:21










  • If you are root (as appears) and your homedir is in fact the rootdir, look at /.ssh/known_hosts and make sure a line for the desired host is in there, then try ssh -v $hostname and look at the logged output.
    – dave_thompson_085
    Aug 15 at 6:23
















  • What's the version of ssh-keyscan you're using on Solaris?
    – slm♦
    Aug 15 at 2:12










  • How do I find out the version of ssh-keyscan?
    – Shan
    Aug 15 at 2:19










  • Can't tell, doesn't appear to display a version.
    – slm♦
    Aug 15 at 2:21










  • If you are root (as appears) and your homedir is in fact the rootdir, look at /.ssh/known_hosts and make sure a line for the desired host is in there, then try ssh -v $hostname and look at the logged output.
    – dave_thompson_085
    Aug 15 at 6:23















What's the version of ssh-keyscan you're using on Solaris?
– slm♦
Aug 15 at 2:12




What's the version of ssh-keyscan you're using on Solaris?
– slm♦
Aug 15 at 2:12












How do I find out the version of ssh-keyscan?
– Shan
Aug 15 at 2:19




How do I find out the version of ssh-keyscan?
– Shan
Aug 15 at 2:19












Can't tell, doesn't appear to display a version.
– slm♦
Aug 15 at 2:21




Can't tell, doesn't appear to display a version.
– slm♦
Aug 15 at 2:21












If you are root (as appears) and your homedir is in fact the rootdir, look at /.ssh/known_hosts and make sure a line for the desired host is in there, then try ssh -v $hostname and look at the logged output.
– dave_thompson_085
Aug 15 at 6:23




If you are root (as appears) and your homedir is in fact the rootdir, look at /.ssh/known_hosts and make sure a line for the desired host is in there, then try ssh -v $hostname and look at the logged output.
– dave_thompson_085
Aug 15 at 6:23










1 Answer
1






active

oldest

votes

















up vote
0
down vote













Looking at the man page for ssh-keyscan on Solaris 10/11 doesn't look to support that switch.



Reference: ssh-keyscan man page

ssh-keyscan [-v46] [-p port] [-T timeout] [-t type] 
[-f file] [-] [host... | addrlist namelist] [...]


I think you can just do ssh-keyscan <hostname> however to retrieve the keys and then write them to your ~/.ssh/known_hosts file. This will still work but just won't put all the names that the host goes by on a single line like this:



hostname1, hostname1.fqdn.com .....


So you might have some cleanup work to do on the resulting known_hosts file.



Host authenticity



If you find you're encountering this issue which amounts to a catch 22, where you cannot scan a host that's not yet present in your known_hosts file:




The authenticity of host 'www.myserver.domain (IP)' can't be established. RSA key fingerprint is FINGERPRINT. Are you sure you want to continue connecting (yes/no)?




You can work around this issue by temporarily disabling StrictHostKeyChecking:



$ cat ~/.ssh/config
...
StrictHostKeyChecking no
...


Then do your keyscan <host> ... command again. Once you're complete, be sure to remove the StrictHostKeyChecking from your ~/.ssh/config.



References



  • ssh_config man page





share|improve this answer






















  • @Shan - what happens if you say y at that prompt?
    – slm♦
    Aug 15 at 11:42










  • host will be added to the list of known_hosts (not recommended; I need to automate this)
    – Shan
    Aug 16 at 2:08











  • @Shan - see updates.
    – slm♦
    Aug 16 at 3:17










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462656%2fequivalent-of-ssh-keyscan-h-in-solaris-10-11%23new-answer', 'question_page');

);

Post as a guest






























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Looking at the man page for ssh-keyscan on Solaris 10/11 doesn't look to support that switch.



Reference: ssh-keyscan man page

ssh-keyscan [-v46] [-p port] [-T timeout] [-t type] 
[-f file] [-] [host... | addrlist namelist] [...]


I think you can just do ssh-keyscan <hostname> however to retrieve the keys and then write them to your ~/.ssh/known_hosts file. This will still work but just won't put all the names that the host goes by on a single line like this:



hostname1, hostname1.fqdn.com .....


So you might have some cleanup work to do on the resulting known_hosts file.



Host authenticity



If you find you're encountering this issue which amounts to a catch 22, where you cannot scan a host that's not yet present in your known_hosts file:




The authenticity of host 'www.myserver.domain (IP)' can't be established. RSA key fingerprint is FINGERPRINT. Are you sure you want to continue connecting (yes/no)?




You can work around this issue by temporarily disabling StrictHostKeyChecking:



$ cat ~/.ssh/config
...
StrictHostKeyChecking no
...


Then do your keyscan <host> ... command again. Once you're complete, be sure to remove the StrictHostKeyChecking from your ~/.ssh/config.



References



  • ssh_config man page





share|improve this answer






















  • @Shan - what happens if you say y at that prompt?
    – slm♦
    Aug 15 at 11:42










  • host will be added to the list of known_hosts (not recommended; I need to automate this)
    – Shan
    Aug 16 at 2:08











  • @Shan - see updates.
    – slm♦
    Aug 16 at 3:17














up vote
0
down vote













Looking at the man page for ssh-keyscan on Solaris 10/11 doesn't look to support that switch.



Reference: ssh-keyscan man page

ssh-keyscan [-v46] [-p port] [-T timeout] [-t type] 
[-f file] [-] [host... | addrlist namelist] [...]


I think you can just do ssh-keyscan <hostname> however to retrieve the keys and then write them to your ~/.ssh/known_hosts file. This will still work but just won't put all the names that the host goes by on a single line like this:



hostname1, hostname1.fqdn.com .....


So you might have some cleanup work to do on the resulting known_hosts file.



Host authenticity



If you find you're encountering this issue which amounts to a catch 22, where you cannot scan a host that's not yet present in your known_hosts file:




The authenticity of host 'www.myserver.domain (IP)' can't be established. RSA key fingerprint is FINGERPRINT. Are you sure you want to continue connecting (yes/no)?




You can work around this issue by temporarily disabling StrictHostKeyChecking:



$ cat ~/.ssh/config
...
StrictHostKeyChecking no
...


Then do your keyscan <host> ... command again. Once you're complete, be sure to remove the StrictHostKeyChecking from your ~/.ssh/config.



References



  • ssh_config man page





share|improve this answer






















  • @Shan - what happens if you say y at that prompt?
    – slm♦
    Aug 15 at 11:42










  • host will be added to the list of known_hosts (not recommended; I need to automate this)
    – Shan
    Aug 16 at 2:08











  • @Shan - see updates.
    – slm♦
    Aug 16 at 3:17












up vote
0
down vote










up vote
0
down vote









Looking at the man page for ssh-keyscan on Solaris 10/11 doesn't look to support that switch.



Reference: ssh-keyscan man page

ssh-keyscan [-v46] [-p port] [-T timeout] [-t type] 
[-f file] [-] [host... | addrlist namelist] [...]


I think you can just do ssh-keyscan <hostname> however to retrieve the keys and then write them to your ~/.ssh/known_hosts file. This will still work but just won't put all the names that the host goes by on a single line like this:



hostname1, hostname1.fqdn.com .....


So you might have some cleanup work to do on the resulting known_hosts file.



Host authenticity



If you find you're encountering this issue which amounts to a catch 22, where you cannot scan a host that's not yet present in your known_hosts file:




The authenticity of host 'www.myserver.domain (IP)' can't be established. RSA key fingerprint is FINGERPRINT. Are you sure you want to continue connecting (yes/no)?




You can work around this issue by temporarily disabling StrictHostKeyChecking:



$ cat ~/.ssh/config
...
StrictHostKeyChecking no
...


Then do your keyscan <host> ... command again. Once you're complete, be sure to remove the StrictHostKeyChecking from your ~/.ssh/config.



References



  • ssh_config man page





share|improve this answer














Looking at the man page for ssh-keyscan on Solaris 10/11 doesn't look to support that switch.



Reference: ssh-keyscan man page

ssh-keyscan [-v46] [-p port] [-T timeout] [-t type] 
[-f file] [-] [host... | addrlist namelist] [...]


I think you can just do ssh-keyscan <hostname> however to retrieve the keys and then write them to your ~/.ssh/known_hosts file. This will still work but just won't put all the names that the host goes by on a single line like this:



hostname1, hostname1.fqdn.com .....


So you might have some cleanup work to do on the resulting known_hosts file.



Host authenticity



If you find you're encountering this issue which amounts to a catch 22, where you cannot scan a host that's not yet present in your known_hosts file:




The authenticity of host 'www.myserver.domain (IP)' can't be established. RSA key fingerprint is FINGERPRINT. Are you sure you want to continue connecting (yes/no)?




You can work around this issue by temporarily disabling StrictHostKeyChecking:



$ cat ~/.ssh/config
...
StrictHostKeyChecking no
...


Then do your keyscan <host> ... command again. Once you're complete, be sure to remove the StrictHostKeyChecking from your ~/.ssh/config.



References



  • ssh_config man page






share|improve this answer














share|improve this answer



share|improve this answer








edited Aug 16 at 3:16

























answered Aug 15 at 2:14









slm♦

238k65492662




238k65492662











  • @Shan - what happens if you say y at that prompt?
    – slm♦
    Aug 15 at 11:42










  • host will be added to the list of known_hosts (not recommended; I need to automate this)
    – Shan
    Aug 16 at 2:08











  • @Shan - see updates.
    – slm♦
    Aug 16 at 3:17
















  • @Shan - what happens if you say y at that prompt?
    – slm♦
    Aug 15 at 11:42










  • host will be added to the list of known_hosts (not recommended; I need to automate this)
    – Shan
    Aug 16 at 2:08











  • @Shan - see updates.
    – slm♦
    Aug 16 at 3:17















@Shan - what happens if you say y at that prompt?
– slm♦
Aug 15 at 11:42




@Shan - what happens if you say y at that prompt?
– slm♦
Aug 15 at 11:42












host will be added to the list of known_hosts (not recommended; I need to automate this)
– Shan
Aug 16 at 2:08





host will be added to the list of known_hosts (not recommended; I need to automate this)
– Shan
Aug 16 at 2:08













@Shan - see updates.
– slm♦
Aug 16 at 3:17




@Shan - see updates.
– slm♦
Aug 16 at 3:17

















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f462656%2fequivalent-of-ssh-keyscan-h-in-solaris-10-11%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)