添加专用的密钥文件从Azure的本地存储资源来选美 [英] Add private key file to Pageant from Azure local storage resource
问题描述
我实施的Azure云服务(工作者角色)应用程序,它可以添加私有密钥文件从Azure的本地存储盛会。在 P
变量是一个过程
这将启动的cmd.exe
为好。
I'm implementing a Cloud Service (worker role) application in Azure which can add private key files to Pageant from an Azure Local Storage. The p
variable is a Process
which starts cmd.exe
as well.
var filename = "pageant.exe";
var workerRoleStorageName = "PrivateKeys";
var privatekeyfilename = "ThePrivateKey.ppk";
var localResource = RoleEnvironment.GetLocalResource(workerRoleStorageName);
var path = Path.Combine(localResource.RootPath, privatekeyfilename);
p.StandardInput.WriteLine(filename + " "+ path);
我在当地的现在,因此路径的含量
变量是这样的:
c:\\Users\\Username\\AppData\\Local\\dftmp\\Resources\\4691e8f6-fdbd-42ad-af67-986b491aca89\\directory\\PrivateKeys\\ThePrivateKey.ppk
c:\Users\Username\AppData\Local\dftmp\Resources\4691e8f6-fdbd-42ad-af67-986b491aca89\directory\PrivateKeys\ThePrivateKey.ppk
但在code的最后一行我有以下错误信息:
But at the last line of code I have got the following error message:
无法加载此键(无法打开文件)。
Couldn't load this key (unable to open file).
这是挺有意思的,因为如果我成立了一个硬codeD简单的路径,它工作正常:
It's quite interesting, because if I set up a hard coded simple path it works fine:
var path = @"E:\PrivateKeys\ThePrivateKey.ppk";
我知道,在Azure本地存储文件夹是隐藏在这种情况下,所以我试图将 E:\\ PrivateKeys
文件夹为隐藏,但它仍与合作硬codeD路径。
I know that the Azure Local Storage folder is hidden in this case, so I tried to set the E:\PrivateKeys
folder to hidden, but it still worked with the hard coded path.
你怎么想,为什么我不能添加该文件从该路径选美?
What do you think, why I can't add this file to Pageant from that path?
推荐答案
未能加载私钥时选美可惜不是非常丰富。它报告的无法加载此键(无法打开文件)。的任何错误,包括非存在和缺乏或读取权限。
Pageant is unfortunately not very informative when failing to load a private key. It reports "Couldn't load this key (unable to open file)." for any error, including non existence and lack or read permissions.
由于是从您的意见明确,在这种特殊情况下,它是缺乏权限。
As is clear from your comments, in this particular instance, it's lack of permissions.
我想你需要运行具有更高的权限或适当的作用,你的应用程序。我不希望你可以只运行的cmd.exe
与较低权限的进程更高的权限。
I suppose you need to run your application with higher privileges or with an appropriate role. I would not expect you can run just the cmd.exe
with higher privileges from a less privileged process.
这篇关于添加专用的密钥文件从Azure的本地存储资源来选美的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!