为非管理员用户帐户中运行的进程创建防火墙规则

发布于 2024-11-01 22:02:53 字数 565 浏览 1 评论 0原文

我有一个基本要求 - 通过在出现提示时创建防火墙规则(打开 Windows 防火墙)来在 Windows 上顺利运行我的应用程序。

当我第一次运行应用程序时以具有管理员权限的用户身份登录系统时,防火墙会出现提示,我通知它允许我的应用程序并创建规则,很好。

但是,当我打开电脑、以非管理员用户身份登录并运行应用程序时,防火墙会按预期显示提示;然而,当我单击与管理员用户相同的选项时,防火墙提示不断弹出,即使我每次出现提示时都单击“允许/确定”。仅当我单击“取消/阻止”应用程序运行时,提示才会消失,这显然不是我想要做的。

所以这里出现了百万美元的问题,我应该在第一次单击防火墙提示以允许我的应用程序时成功创建防火墙规则来更改我的应用程序代码以顺利运行;与我以具有管理员权限的用户身份运行应用程序时的工作方式完全相同。

我已经在网上进行了一些搜索,并了解到非管理员用户无法修改防火墙规则(甚至无法创建它们???)。顺便说一句,我已经在 Windows XP、Vista 7 x86 和 x64 上测试了这种情况,结果相同。

如果有人遇到和/或解决了类似的问题,请分享您的知识。如果我遗漏了什么,请让我明白我遗漏了什么。

谢谢

I have a basic requirement - to run my application smoothly on Windows by creating firewall rules when prompted, that has windows firewall turned-ON.

When I log in to my system as an user with Admin privileges when I run my application the first time, the firewall comes up with a prompt, I inform it to allow my app and create a rule, nice.

However when I turn-on my PC, log in as a non-Admin user, and I run my application, the firewall shows up with a prompt as expected; however when I click on the same options as I did from the Admin user, the firewall prompt keeps popping up continuously even though I clicked on Allow /ok every time the prompt appears. The prompt only goes away when I click on "Cancel / Block" the application from running, which is obviously not what I want to do.

So here comes the million $ question, What and How should I change my application code to run smoothly by creating the firewall rule successfully the first time I click on the firewall prompt to allow my application; exactly the same way it is working when I run my application as an user with Admin privileges.

I have done my bit of searching online and have come to understand that Non-admin users cannot modify firewall rules (cannot even create them???). BTW I have tested this scenario on Windows XP, Vista 7 both x86 and x64 with same results.

If someone has encountered and / or solved similar issues please share your knowledge. If I am missing something, please make me understand what I am missing.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

乜一 2024-11-08 22:02:53

我认为您所尝试的操作在非管理员帐户中是不可能的。您可以尝试通过创建新进程来使用 Windows runas 功能来获得 admin 权限,以便提示用户输入用户名 > 和管理员帐户的密码,这将为您的程序提供为您的程序创建防火墙规则所需的访问权限。

您还可以查看 CreateProcessAsUserLogOnUSer 。基本上,为了成功完成您想要做的事情,您需要一个代表管理员帐户或具有管理员权限的帐户的令牌。

I don't think what you are trying is possible in a non-admin account. What you may try is to gain admin privilege by using the windows runas feature by creating a new process, so that the user is prompted for the username and password of the Admin Account, which would give your program the required access to create firewall rules for your program.

You may also take a look into CreateProcessAsUser or LogOnUSer . Basically in order to succeed in what you are trying to do, you need a token that represents the Administrator account or an account which has admin privileges.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文