0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

SMBとNTFSセキュリティの基礎の備忘

Posted at

必要な情報の取得

Get-Acl パス |Select-Object -Property *

アクセス権だけ表示

Get-Acl $Path |Select-Object -Property AccessToString|fl

(Get-Item $Path).GetAccessControl()|fl

NTFS(でも動くけど)じゃなくてSMBのディレクトリ(フォルダー)にアクセス権を追加する時

やっと動くものができた。
ずっと [Set-Acl], UnauthorizedAccessException出て困ってた。

# ファイルやディレクトリ名
$Path = "\\NAS\share\dir"
# ユーザ名やグループ名(ドメイン名またはコンピュータ名から指定)
$userGroup = "domain users"

$acl = (Get-Item $Path).GetAccessControl("access")
$permission = ($userGroup,"FullControl","None","None","Allow")
$accessRule = New-Object -TypeName System.Security.AccessControl.FileSystemAccessRule $permission
$acl.AddAccessRule($AccessRule)
(Get-Item $Path).SetAccessControl($acl)

参考文献

https://yomon.hatenablog.com/entry/2015/04/10/170518
https://cloudsteady.jp/post/24290/
https://qiita.com/kazuki-ma/items/34edd224043568555674
これが決め手でした。
https://ktltechnoblog.wordpress.com/2018/02/21/set-acl-attempted-to-perform-an-unauthorized-operation/

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?