How to list loaded SSH keys in Windows (pageant)





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















I'm trying to create simple Windows batch script that will manage connectivity to our client. That includes some tunnels using plink.exe and socks chain. Each hop requires ssh key authentication for which I'm using pageant.exe.



I have each piece scripted out as needed, except the pageant part, where I struggle. Facts encountered:



If I only start pageant.exe it will start pageant agent without any SSH key loaded and script will continue right away. Then I can run pageant.exe my_key.ppk to add the key into pageant and passphrase will be prompted, however script will continue meanwhile as well, so script will continue to plink part which will fail, because user will not provide passphrase till that time.



I've been looking into pageant docs and found some CLI switches like -l that supposedly should list loaded keys, that however does not seems to work on Windows version. Seems like windows version is only accepting arguments in form of .ppk files



I'd like to basically make some kind of "wait" function until user will provide passphrase. Is there any way how to either list loaded keys directly from pageant or any generic method asking Windows environment for SSH keys?










share|improve this question

























  • Possible duplicate of Run a batch file when Pageant finishes loading SSH keys

    – Martin Prikryl
    Dec 4 '18 at 7:11


















1















I'm trying to create simple Windows batch script that will manage connectivity to our client. That includes some tunnels using plink.exe and socks chain. Each hop requires ssh key authentication for which I'm using pageant.exe.



I have each piece scripted out as needed, except the pageant part, where I struggle. Facts encountered:



If I only start pageant.exe it will start pageant agent without any SSH key loaded and script will continue right away. Then I can run pageant.exe my_key.ppk to add the key into pageant and passphrase will be prompted, however script will continue meanwhile as well, so script will continue to plink part which will fail, because user will not provide passphrase till that time.



I've been looking into pageant docs and found some CLI switches like -l that supposedly should list loaded keys, that however does not seems to work on Windows version. Seems like windows version is only accepting arguments in form of .ppk files



I'd like to basically make some kind of "wait" function until user will provide passphrase. Is there any way how to either list loaded keys directly from pageant or any generic method asking Windows environment for SSH keys?










share|improve this question

























  • Possible duplicate of Run a batch file when Pageant finishes loading SSH keys

    – Martin Prikryl
    Dec 4 '18 at 7:11














1












1








1


1






I'm trying to create simple Windows batch script that will manage connectivity to our client. That includes some tunnels using plink.exe and socks chain. Each hop requires ssh key authentication for which I'm using pageant.exe.



I have each piece scripted out as needed, except the pageant part, where I struggle. Facts encountered:



If I only start pageant.exe it will start pageant agent without any SSH key loaded and script will continue right away. Then I can run pageant.exe my_key.ppk to add the key into pageant and passphrase will be prompted, however script will continue meanwhile as well, so script will continue to plink part which will fail, because user will not provide passphrase till that time.



I've been looking into pageant docs and found some CLI switches like -l that supposedly should list loaded keys, that however does not seems to work on Windows version. Seems like windows version is only accepting arguments in form of .ppk files



I'd like to basically make some kind of "wait" function until user will provide passphrase. Is there any way how to either list loaded keys directly from pageant or any generic method asking Windows environment for SSH keys?










share|improve this question
















I'm trying to create simple Windows batch script that will manage connectivity to our client. That includes some tunnels using plink.exe and socks chain. Each hop requires ssh key authentication for which I'm using pageant.exe.



I have each piece scripted out as needed, except the pageant part, where I struggle. Facts encountered:



If I only start pageant.exe it will start pageant agent without any SSH key loaded and script will continue right away. Then I can run pageant.exe my_key.ppk to add the key into pageant and passphrase will be prompted, however script will continue meanwhile as well, so script will continue to plink part which will fail, because user will not provide passphrase till that time.



I've been looking into pageant docs and found some CLI switches like -l that supposedly should list loaded keys, that however does not seems to work on Windows version. Seems like windows version is only accepting arguments in form of .ppk files



I'd like to basically make some kind of "wait" function until user will provide passphrase. Is there any way how to either list loaded keys directly from pageant or any generic method asking Windows environment for SSH keys?







windows batch-file ssh plink pageant






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 26 '18 at 17:39









Martin Prikryl

91.6k22183386




91.6k22183386










asked Nov 26 '18 at 15:41









Ricky-BrnoRicky-Brno

1177




1177













  • Possible duplicate of Run a batch file when Pageant finishes loading SSH keys

    – Martin Prikryl
    Dec 4 '18 at 7:11



















  • Possible duplicate of Run a batch file when Pageant finishes loading SSH keys

    – Martin Prikryl
    Dec 4 '18 at 7:11

















Possible duplicate of Run a batch file when Pageant finishes loading SSH keys

– Martin Prikryl
Dec 4 '18 at 7:11





Possible duplicate of Run a batch file when Pageant finishes loading SSH keys

– Martin Prikryl
Dec 4 '18 at 7:11












1 Answer
1






active

oldest

votes


















1














Pageant has -c switch, which you can use to pass a command to be executed after a private key is loaded:




You can arrange for Pageant to start another program once it has initialised itself and loaded any keys specified on its command line. This program (perhaps a PuTTY, or a WinCVS making use of Plink, or whatever) will then be able to use the keys Pageant has loaded.



You do this by specifying the -c option followed by the command, like this:



C:PuTTYpageant.exe d:main.ppk -c C:PuTTYputty.exe





Though in general Pageant is a tool for an interactive use, not for scripting. For scripting, use -i switch of Plink to provide a private key for authentication.






share|improve this answer





















  • 1





    oh, how obvious. Shame on me. That did the trick! Thanks a bunch Martin

    – Ricky-Brno
    Nov 27 '18 at 9:02












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53484559%2fhow-to-list-loaded-ssh-keys-in-windows-pageant%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














Pageant has -c switch, which you can use to pass a command to be executed after a private key is loaded:




You can arrange for Pageant to start another program once it has initialised itself and loaded any keys specified on its command line. This program (perhaps a PuTTY, or a WinCVS making use of Plink, or whatever) will then be able to use the keys Pageant has loaded.



You do this by specifying the -c option followed by the command, like this:



C:PuTTYpageant.exe d:main.ppk -c C:PuTTYputty.exe





Though in general Pageant is a tool for an interactive use, not for scripting. For scripting, use -i switch of Plink to provide a private key for authentication.






share|improve this answer





















  • 1





    oh, how obvious. Shame on me. That did the trick! Thanks a bunch Martin

    – Ricky-Brno
    Nov 27 '18 at 9:02
















1














Pageant has -c switch, which you can use to pass a command to be executed after a private key is loaded:




You can arrange for Pageant to start another program once it has initialised itself and loaded any keys specified on its command line. This program (perhaps a PuTTY, or a WinCVS making use of Plink, or whatever) will then be able to use the keys Pageant has loaded.



You do this by specifying the -c option followed by the command, like this:



C:PuTTYpageant.exe d:main.ppk -c C:PuTTYputty.exe





Though in general Pageant is a tool for an interactive use, not for scripting. For scripting, use -i switch of Plink to provide a private key for authentication.






share|improve this answer





















  • 1





    oh, how obvious. Shame on me. That did the trick! Thanks a bunch Martin

    – Ricky-Brno
    Nov 27 '18 at 9:02














1












1








1







Pageant has -c switch, which you can use to pass a command to be executed after a private key is loaded:




You can arrange for Pageant to start another program once it has initialised itself and loaded any keys specified on its command line. This program (perhaps a PuTTY, or a WinCVS making use of Plink, or whatever) will then be able to use the keys Pageant has loaded.



You do this by specifying the -c option followed by the command, like this:



C:PuTTYpageant.exe d:main.ppk -c C:PuTTYputty.exe





Though in general Pageant is a tool for an interactive use, not for scripting. For scripting, use -i switch of Plink to provide a private key for authentication.






share|improve this answer















Pageant has -c switch, which you can use to pass a command to be executed after a private key is loaded:




You can arrange for Pageant to start another program once it has initialised itself and loaded any keys specified on its command line. This program (perhaps a PuTTY, or a WinCVS making use of Plink, or whatever) will then be able to use the keys Pageant has loaded.



You do this by specifying the -c option followed by the command, like this:



C:PuTTYpageant.exe d:main.ppk -c C:PuTTYputty.exe





Though in general Pageant is a tool for an interactive use, not for scripting. For scripting, use -i switch of Plink to provide a private key for authentication.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 27 '18 at 9:03

























answered Nov 26 '18 at 17:39









Martin PrikrylMartin Prikryl

91.6k22183386




91.6k22183386








  • 1





    oh, how obvious. Shame on me. That did the trick! Thanks a bunch Martin

    – Ricky-Brno
    Nov 27 '18 at 9:02














  • 1





    oh, how obvious. Shame on me. That did the trick! Thanks a bunch Martin

    – Ricky-Brno
    Nov 27 '18 at 9:02








1




1





oh, how obvious. Shame on me. That did the trick! Thanks a bunch Martin

– Ricky-Brno
Nov 27 '18 at 9:02





oh, how obvious. Shame on me. That did the trick! Thanks a bunch Martin

– Ricky-Brno
Nov 27 '18 at 9:02




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53484559%2fhow-to-list-loaded-ssh-keys-in-windows-pageant%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Wiesbaden

Marschland

Dieringhausen