LoginSignup
2
1

More than 3 years have passed since last update.

hostsファイルに書き込み権限付与 (windows)

Last updated at Posted at 2019-07-01

概要

開発のWindowsパソコンでhostsファイルを管理者権限なしで自分のユーザーで修正できるように権限変更する。

powershell

下記コマンドを実行する。
※powershellを管理者権限で起動し、下記コマンドを実行する。

> cacls C:\Windows\System32\drivers\etc\hosts /E /G {ユーザー名}:W

※ hostsファイルのパスは環境に合わせて変更してください。
※ ユーザー名も自分のユーザーに変更する。

Get-Aclコマンドでアクセス権限の付与を確認する。

> Get-Acl -Path hosts | select -expand access

FileSystemRights  : ExecuteFile, Write, ReadPermissions, Synchronize
AccessControlType : Allow
IdentityReference : {ユーザー名}
IsInherited       : False
InheritanceFlags  : None
PropagationFlags  : None

今付与したユーザーが表示されているので追加できているようです。

参考サイト

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1