ちゃっぴの監禁部屋

ガチガチに締めすぎて動きがとれなくなる。。。

ホーム 連絡をする 同期する ( RSS 2.0 ) Login
投稿数  405  : 記事  5  : コメント  12059  : トラックバック  134

ニュース

記事カテゴリ

書庫

日記カテゴリ

Communities

Personal Information

FAQ に Task Scheduler から batch file が実行できないというのがありますが、これは Task Scheduler で起動される user の logon type が違うために発生します。

Windows に logon する時その user が所属している group を access token に格納し、その access token を持った process を作成します。その時に格納されるものは、mmc とかで見える group だけではなく、logon type に紐づいた group も一緒に格納されます。

通常の logon (対話的ログオン: interactive logon) の場合には、"NT AUTHORITY\INTERACTIVE" が access token の group infomation に格納されます。 

Windows Server 2003 R2 で対話的に logon した場合の "whoami.exe" の結果(抜粋)

グループ名                            種類                 SID          属性                                                   
===================================== ==================== ============ ========================================================
Everyone                              よく知られたグループ S-1-1-0      固定グループ, 既定で有効, 有効なグループ               
BUILTIN\Administrators                エイリアス           S-1-5-32-544 固定グループ, 既定で有効, 有効なグループ, グループ所有者
BUILTIN\Users                         エイリアス           S-1-5-32-545 固定グループ, 既定で有効, 有効なグループ                             
NT AUTHORITY\INTERACTIVE              よく知られたグループ S-1-5-4      固定グループ, 既定で有効, 有効なグループ               
NT AUTHORITY\Authenticated Users      よく知られたグループ S-1-5-11     固定グループ, 既定で有効, 有効なグループ               
NT AUTHORITY\This Organization        よく知られたグループ S-1-5-15     固定グループ, 既定で有効, 有効なグループ               
LOCAL                                 よく知られたグループ S-1-2-0      固定グループ, 既定で有効, 有効なグループ               
NT AUTHORITY\NTLM Authentication      よく知られたグループ S-1-5-64-10  固定グループ, 既定で有効, 有効なグループ

"NT AUTHORITY\INTERACTIVE" が確認できると思います。

次に Task Scheduler で起動した場合の状況を見てみましょう。

グループ名                       種類                 SID          属性                                                   
================================ ==================== ============ ========================================================
Everyone                         よく知られたグループ S-1-1-0      固定グループ, 既定で有効, 有効なグループ               
BUILTIN\Administrators           エイリアス           S-1-5-32-544 固定グループ, 既定で有効, 有効なグループ, グループ所有者
BUILTIN\Users                    エイリアス           S-1-5-32-545 固定グループ, 既定で有効, 有効なグループ               
NT AUTHORITY\BATCH               よく知られたグループ S-1-5-3      固定グループ, 既定で有効, 有効なグループ               
NT AUTHORITY\Authenticated Users よく知られたグループ S-1-5-11     固定グループ, 既定で有効, 有効なグループ               
NT AUTHORITY\This Organization   よく知られたグループ S-1-5-15     固定グループ, 既定で有効, 有効なグループ               
LOCAL                            よく知られたグループ S-1-2-0      固定グループ, 既定で有効, 有効なグループ               
NT AUTHORITY\NTLM Authentication よく知られたグループ S-1-5-64-10  固定グループ, 既定で有効, 有効なグループ               

"NT AUTHORITY\INTERACTIVE" が存在せず、"NT AUTHORITY\BATCH" が存在しますね。

でも、これ対象の実行 user が interactive logon していないからなんです。実は、Task Scheduler からの実行は、実行予定の user がすでに logon している場合には、その access token をそのまま利用します。Task Scheduler から job を起動した場合、必ずしも batch logon するとは限らないことに注意してください。

で本題ですが、batch file の拡張子 (*.bat, *.cmd) は "cmd.exe" に関連付いています。ということで "cmd.exe" の ACL を覗いてみましょう。

BUILTIN\Administrators:F
NT AUTHORITY\INTERACTIVE:R
NT AUTHORITY\SERVICE:R
NT AUTHORITY\SYSTEM:F
NEVILLE\TelnetClients:R

Administrators の member なら問題なく実行できますが、それ以外の一般 user の場合には、interactive logon が必須になっています。ただし、batch job を batch file で書きたいという要望は結構あると思います。

なら、Administrators の member で実行するという手もあるんですが、こいつはご法度です。というのは、最低限の権限で実行すべき security の原則を満たしていないからです。どうしても Administrators の member でしか出来ない処理を除き、Administrators の member は使うべきではないです。

では、どうすればよいか?

1つの方法としては、その batch job を実行する user を "cmd.exe" の ACL に追加する方法です。この方法は、その user が batch job のみを実行することが保障されている状況のみ利用すべきです。もし、その user が IIS 等で使われると OS command injection を食らう可能性があります。また、batch job の実行 user が増えてくると大変というのもありますね。

もう一つの方法としては、"NT AUTHORITY\BATCH" 読み取りと実行を "cmd.exe" の ACL に設定してやる方法です。こちらが個人的にはお勧めです。

Windows Server 2003 ではこのように logon type によって access control を行っているものが多いので、logon type を常に意識するようにしましょう。

投稿日時 : 2007年7月8日 19:07

コメント

# MSfxiXHECTSXE 2021/07/03 2:35 https://amzn.to/365xyVY
I think other web site proprietors should take this site as an model, very clean and great user friendly style and design, as well as the content. You are an expert in this topic!

# buy doxycycline for dogs https://doxycyline1st.com/
doxycycline hydrochloride 100mg 2022/02/26 0:38 Jusidkid
buy doxycycline for dogs https://doxycyline1st.com/
doxycycline hydrochloride 100mg

# where to get doxycycline https://doxycyline1st.com/
where to purchase doxycycline 2022/02/26 9:41 Jusidkid
where to get doxycycline https://doxycyline1st.com/
where to purchase doxycycline

# purchase clomid http://clomidfast.site/ 2022/04/12 12:56 Clomids
purchase clomid http://clomidfast.site/

# furosemide 100 mg https://buylasix.icu/
lasix furosemide 2022/06/24 17:08 LasixRx
furosemide 100 mg https://buylasix.icu/
lasix furosemide

# clomid tablets https://clomidonline.icu/ 2022/07/08 13:36 Clomidj
clomid tablets https://clomidonline.icu/

# carprofen without vet prescription: https://medrxfast.com/ 2022/08/03 19:07 MedsRxFast
carprofen without vet prescription: https://medrxfast.com/

# metformin buy canada https://glucophage.top/
metformin 80 mg 2022/08/23 7:52 Niujsdkj
metformin buy canada https://glucophage.top/
metformin 80 mg

# non prescription erection pills https://ed-pills.xyz/
generic ed pills 2022/09/16 7:33 EdPills
non prescription erection pills https://ed-pills.xyz/
generic ed pills

# doxycycline hyc 100mg https://buydoxycycline.icu/ 2022/10/08 11:54 Doxycycline
doxycycline hyc 100mg https://buydoxycycline.icu/

#  https://clomidforsale.site/ 2022/11/13 14:23 ForSale
https://clomidforsale.site/

# prednisone 54 https://prednisonepills.site/
prednisone 1mg purchase 2022/11/30 0:53 Prednisone
prednisone 54 https://prednisonepills.site/
prednisone 1mg purchase

# medication for ed https://edpills.science/
impotence pills 2023/01/07 8:43 Edpills
medication for ed https://edpills.science/
impotence pills

# Drug information. All trends of medicament.
https://edonlinefast.com
Everything information about medication. Read information now. 2023/02/18 0:51 EdOnline
Drug information. All trends of medicament.
https://edonlinefast.com
Everything information about medication. Read information now.

# pillole per erezioni fortissime https://viasenzaricetta.com/# 2023/04/16 13:12 ViaSenza
pillole per erezioni fortissime https://viasenzaricetta.com/#

# buy cheap doxycycline - https://doxycyclinesale.pro/# 2023/04/21 17:36 Doxycycline
buy cheap doxycycline - https://doxycyclinesale.pro/#

# canine prednisone 5mg no prescription - https://prednisonesale.pro/# 2023/04/22 4:53 Prednisone
canine prednisone 5mg no prescription - https://prednisonesale.pro/#

# buy cytotec pills - https://cytotecsale.pro/# 2023/04/29 4:46 Cytotec
buy cytotec pills - https://cytotecsale.pro/#

# over the counter anti inflammatory https://overthecounter.pro/# 2023/05/08 22:51 OtcJikoliuj
over the counter anti inflammatory https://overthecounter.pro/#

# prednisone drug costs https://prednisonepills.pro/# - buy prednisone mexico 2023/06/04 21:33 Prednisone
prednisone drug costs https://prednisonepills.pro/# - buy prednisone mexico

# paxlovid for sale https://paxlovid.pro/# - paxlovid 2023/07/02 17:33 Paxlovid
paxlovid for sale https://paxlovid.pro/# - paxlovid

# п»їonline apotheke 2023/09/26 12:02 Williamreomo
http://onlineapotheke.tech/# gГ?nstige online apotheke
online apotheke gГ?nstig

# gГјnstige online apotheke 2023/09/26 23:00 Williamreomo
https://onlineapotheke.tech/# online apotheke gГ?nstig
online apotheke deutschland

# internet apotheke 2023/09/26 23:56 Williamreomo
http://onlineapotheke.tech/# internet apotheke
versandapotheke deutschland

# п»їonline apotheke 2023/09/27 6:17 Williamreomo
http://onlineapotheke.tech/# internet apotheke
internet apotheke

# online apotheke gГјnstig 2023/09/27 12:45 Williamreomo
http://onlineapotheke.tech/# online apotheke preisvergleich
versandapotheke deutschland

# п»їfarmacia online migliore 2023/09/27 21:03 Rickeyrof
acheter sildenafil 100mg sans ordonnance

# comprare farmaci online con ricetta 2023/09/27 22:25 Rickeyrof
acheter sildenafil 100mg sans ordonnance

# erection pills that work https://edpillsotc.store/# - medication for ed 2023/10/08 1:17 EdPills
erection pills that work https://edpillsotc.store/# - medication for ed

# how to get a prescription in canada 2023/10/16 22:09 Dannyhealm
The best choice for personalized care. https://mexicanpharmonline.shop/# mexico drug stores pharmacies

# mail order pharmacies canada 2023/10/17 11:22 Dannyhealm
Their worldwide outreach programs are commendable. http://mexicanpharmonline.shop/# mexican border pharmacies shipping to usa

# pharm canada 2023/10/17 21:00 Dannyhealm
Setting the benchmark for global pharmaceutical services. https://mexicanpharmonline.com/# mexican mail order pharmacies

# best rated canadian pharmacies 2023/10/17 21:34 Dannyhealm
Their adherence to safety protocols is commendable. https://mexicanpharmonline.com/# mexican rx online

# mexico drug store online 2023/10/17 22:42 Dannyhealm
Their mobile app makes managing my medications so easy. http://mexicanpharmonline.com/# mexico drug stores pharmacies

# licensed canadian pharmacies 2023/10/18 9:02 Dannyhealm
Their health awareness programs are game-changers. http://mexicanpharmonline.com/# reputable mexican pharmacies online

# buy rx online 2023/10/18 19:29 Dannyhealm
Learn about the side effects, dosages, and interactions. http://mexicanpharmonline.shop/# mexico drug stores pharmacies

# pills erectile dysfunction https://edpills.tech/# best male ed pills 2023/12/23 8:15 EdPills
pills erectile dysfunction https://edpills.tech/# best male ed pills

# get cheap clomid pills 2023/12/27 3:08 RaymondGrido
https://paxlovid.win/# buy paxlovid online

# п»їpaxlovid 2023/12/28 8:55 Brianmooda
http://clomid.site/# where can i get cheap clomid price

# amoxil generic 2024/01/12 11:04 Robertdub
https://prednisone.auction/# where can i get prednisone

# buy cytotec pills online cheap 2024/01/13 6:17 Keithturse
http://furosemide.pro/# furosemide 100 mg

# farmacia online miglior prezzo 2024/01/16 15:40 Robertopramy
https://tadalafilitalia.pro/# farmacia online

# comprare farmaci online all'estero 2024/01/17 8:27 Robertopramy
https://tadalafilitalia.pro/# comprare farmaci online all'estero

# п»їfarmacia online migliore 2024/01/17 12:29 Walterpoume
http://avanafilitalia.online/# top farmacia online

# tamoxifen rash pictures 2024/01/20 19:25 Normantug
http://cytotec.directory/# purchase cytotec

# how can i get clomid for sale 2024/01/20 20:32 LarryVoP
A trusted partner for patients worldwide https://clomidpharm.shop/# where to buy cheap clomid

# tamoxifen generic 2024/01/21 7:32 Normantug
http://prednisonepharm.store/# prednisone 5mg price

# can you buy generic clomid pills 2024/01/21 22:37 LarryVoP
Leading with compassion on a global scale https://clomidpharm.shop/# can i buy cheap clomid for sale

# where buy clomid for sale 2024/01/22 4:17 LarryVoP
Every international delivery is prompt and secure https://cytotec.directory/# buy cytotec online

# canadian rx 2024/01/23 9:04 Stevenhex
http://edpills.bid/# ed pills

# ivermectin 8000 mcg 2024/01/30 8:00 Andrewamabs
http://ivermectin.store/# stromectol tab 3mg

# buy stromectol canada 2024/01/30 15:15 Andrewamabs
http://ivermectin.store/# stromectol cream

# trusted canadian pharmacies 2024/02/11 10:51 Williamzelia
http://edwithoutdoctorprescription.pro/# prescription meds without the prescriptions

# mexican pharmaceuticals online 2024/02/16 10:34 TravisFlaks
http://mexicanph.shop/# pharmacies in mexico that ship to usa
mexican pharmaceuticals online

# zestril tablet 2024/02/26 1:49 Charlesmax
https://stromectol.fun/# ivermectin generic

# buy cytotec online fast delivery 2024/03/02 4:04 Irvinliz
http://doxycycline.auction/# doxycycline hyclate

# topchatsites 2024/03/04 6:08 RodrigoGrany
https://abelladanger.online/# abella danger video

# best datings sites 2024/03/05 12:48 RodrigoGrany
http://abelladanger.online/# abella danger video

# sweetie fox full video https://sweetiefox.pro/ - fox sweetie
2024/03/06 22:11 SwitieFox
sweetie fox full video https://sweetiefox.pro/ - fox sweetie


# meet= dating dating 2024/03/07 5:39 HowardBox
free app for online meeting: http://sweetiefox.pro/# ph sweetie fox

# dating apps free 2024/03/07 21:59 HowardBox
single chat sites: https://miamalkova.life/# mia malkova only fans

# free dateing sites 2024/03/10 8:22 HowardBox
date me site: https://miamalkova.life/# mia malkova only fans

# aplicativo de aposta 2024/03/14 9:14 BrianTop
http://jogodeaposta.fun/# jogos que dao dinheiro

# melhor jogo de aposta 2024/03/14 20:25 BrianTop
https://aviatormalawi.online/# aviator game online

# site de apostas 2024/03/15 7:35 BrianTop
https://jogodeaposta.fun/# jogos que dao dinheiro

# medications online without prescriptions 2024/03/23 14:45 Carloshab
http://mexicanpharm.online/# pharmacies in mexico that ship to usa

# gates of olympus 2024/03/28 5:46 KeithNaf
http://sweetbonanza.bid/# sweet bonanza mostbet

# gate of olympus hile 2024/03/28 20:26 KeithNaf
http://aviatoroyna.bid/# aviator sinyal hilesi ucretsiz

# how can i get generic clomid price 2024/04/04 12:52 Robertsuela
https://clomidall.com/# how can i get cheap clomid without insurance

# can you get generic clomid tablets 2024/04/04 17:02 Robertsuela
https://prednisoneall.com/# prednisone 20 mg prices

# how to buy doxycycline online 2024/04/13 4:43 Archiewef
https://doxycyclinest.pro/# doxycycline 100mg online

Post Feedback

タイトル
名前
Url:
コメント