Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Server > Scripting > Re: Access protected folders using system account

Reply
Thread Tools Display Modes

Re: Access protected folders using system account

 
 
Pegasus
Guest
Posts: n/a

 
      03-11-2009

"Juan" <> wrote in message
news:f7626b92-bc13-43c8-a41b-...
> Hi,
>
> I'm developing a vbscript. The vbscript needs to access every file, or
> folder, in the local hard disks. I only need to access the name of the
> file. I'm using Windows XP and a NTFS partition, so it's possible to
> restrict access to a folder so only for the owner is able to access
> the folder.
>
> To avoid this situation, It's suppose that the NT AUTHORITY/system
> account is able to access every file in the system. To execute the
> vbscript I'm using the Scheduled Tasks, using the system account. But,
> when the script tries to access a protected folder a "Permission
> denied" error is returned.
>
> Does anybody have any idea what can be happening?.
>
> Thank you very much.
>
> Regards.
>
> Juan.


Run the batch file c:\Juan.bat (see below) in three modes:
a) When logged on as Administrator
b) As a scheduled task in the same way as you do with your script.
c) As a scheduled task, invoked like so:
at 16:45 c:\Juan.bat
(Make sure the time is 5 minutes in the future)

@echo off
set folder=d:\Some Folder
echo %date% %time% %UserName% >> c:\test.txt
cacls "%folder%" 1>>c:\test.txt 2>>&1
dir "%folder%" 1>>c:\test.txt 2>>&1
echo. 1>>c:\test.txt 2>>&1

When finished, post the contents of c:\test.txt.


 
Reply With Quote
 
 
 
 
Pegasus [MVP]
Guest
Posts: n/a

 
      03-12-2009

"Juan" <> wrote in message
news:43c76394-5c51-4cef-8bf1-...
On Mar 11, 4:17 pm, "Pegasus" <n...@microsoft.com> wrote:
> "Juan" <jvaleromt...@gmail.com> wrote in message
>
> news:f7626b92-bc13-43c8-a41b-...
>
>
>
>
>
> > Hi,

>
> > I'm developing a vbscript. The vbscript needs to access every file, or
> > folder, in the local hard disks. I only need to access the name of the
> > file. I'm using Windows XP and a NTFS partition, so it's possible to
> > restrict access to a folder so only for the owner is able to access
> > the folder.

>
> > To avoid this situation, It's suppose that the NT AUTHORITY/system
> > account is able to access every file in the system. To execute the
> > vbscript I'm using the Scheduled Tasks, using the system account. But,
> > when the script tries to access a protected folder a "Permission
> > denied" error is returned.

>
> > Does anybody have any idea what can be happening?.

>
> > Thank you very much.

>
> > Regards.

>
> > Juan.

>
> Run the batch file c:\Juan.bat (see below) in three modes:
> a) When logged on as Administrator
> b) As a scheduled task in the same way as you do with your script.
> c) As a scheduled task, invoked like so:
> at 16:45 c:\Juan.bat
> (Make sure the time is 5 minutes in the future)
>
> @echo off
> set folder=d:\Some Folder
> echo %date% %time% %UserName% >> c:\test.txt
> cacls "%folder%" 1>>c:\test.txt 2>>&1
> dir "%folder%" 1>>c:\test.txt 2>>&1
> echo. 1>>c:\test.txt 2>>&1
>
> When finished, post the contents of c:\test.txt.- Hide quoted text -
>
> - Show quoted text -


Hi Pegasus,

First of all, thank you very much for your help.

I send the results of the batch file in the tree modes. It's extrange
that the user name in the cases b and c does not appear.

Test_administrator.txt
------------------------------------------------------------------
12/03/2009 10:38:04,35 Administrator
e:\HPAdmin
Access is denied.
Volume in drive E is Datos
Volume Serial Number is 4E37-C425

Directory of e:\HPAdmin

File Not Found

Test_sch.txt
------------------------------------------------------------------
12/03/2009 10:40:21,01
e:\HPAdmin
Access is denied.
Volume in drive E is Datos
Volume Serial Number is 4E37-C425

Directory of e:\HPAdmin

File Not Found

Test_at.txt
------------------------------------------------------------------
12/03/2009 10:39:00,07
e:\HPAdmin
Access is denied.
Volume in drive E is Datos
Volume Serial Number is 4E37-C425

Directory of e:\HPAdmin

File Not Found


I tried something similar, in my script I added a function to show the
username. And when the script was executed with Scheduled Task or at
command, the SYSTEM user was showed.

The function, that I used, was:

Function WhoAmI

Dim objNetwork
Dim strCurrentUserName, strCurrentDomainName, strFullUserName
Dim strComputerName

Set objNetwork = WScript.CreateObject("WScript.Network")

strCurrentUserName = objNetwork.UserName
strCurrentDomainName = objNetwork.UserDomain
strComputerName = objNetwork.ComputerName

strFullUserName = strCurrentUserName

WhoAmI = strFullUserName
' WScript.Echo "Current logged in user: " & strFullUserName & " on
" & strComputerName & VbCrLf

End Function

Again, thank you very much.

Regards.

================

I had forgotten that the System account does not show up when you run a
session under this account.

Toget back to your main issue: I would do this -
1. Seize ownership of the folder.
2. Set the permissions so that only the System and the user's account can
access the folder.
3. Use at.exe to run my batch file to recheck the permission structure.


 
Reply With Quote
 
Pegasus [MVP]
Guest
Posts: n/a

 
      03-13-2009

"Juan" <> wrote in message
news:2e435b2e-8c77-4864-83a2-...

<snip>

Hi Pegasus,

I've made the steps you told me.

As you can see, It's possible to access the folder. But, the question
is. Would it be possible to access the folder, using a script executed
by the SYSTEM account, if I remove the permissions for the SYSTEM
user?.

==============

No, it isn't.


 
Reply With Quote
 
Pegasus
Guest
Posts: n/a

 
      03-13-2009

"Juan" <> wrote in message
news:6f4f0b80-4d39-4abc-a0c1-...
On Mar 13, 10:53 am, "Pegasus [MVP]" <n...@microsoft.com> wrote:
> "Juan" <jvaleromt...@gmail.com> wrote in message
>
> news:2e435b2e-8c77-4864-83a2-...
>
> <snip>
>
> Hi Pegasus,
>
> I've made the steps you told me.
>
> As you can see, It's possible to access the folder. But, the question
> is. Would it be possible to access the folder, using a script executed
> by the SYSTEM account, if I remove the permissions for the SYSTEM
> user?.
>
> ==============
>
> No, it isn't.


Pegasus,

Thank you very much for your help.

Only one thinking... I don't understand why some antivirus software (I
have installed Symantec) is able to access folders with kind of
permissions. I suppose, the antivirus software has a way to bypass
NTFS security.

Regards.

==================

What makes you think that AV software can access folders that are beyond the
reach of the System account?


 
Reply With Quote
 
Pegasus
Guest
Posts: n/a

 
      03-13-2009

"Juan" <> wrote in message
news:97fbb24a-8bb7-41af-a0e1-...
> On 13 mar, 18:12, "Pegasus" <n...@microsoft.com> wrote:
>> "Juan" <jvaleromt...@gmail.com> wrote in message
>>
>> news:6f4f0b80-4d39-4abc-a0c1-...
>> On Mar 13, 10:53 am, "Pegasus [MVP]" <n...@microsoft.com> wrote:
>>
>>
>>
>>
>>
>> > "Juan" <jvaleromt...@gmail.com> wrote in message

>>
>> >news:2e435b2e-8c77-4864-83a2-...

>>
>> > <snip>

>>
>> > Hi Pegasus,

>>
>> > I've made the steps you told me.

>>
>> > As you can see, It's possible to access the folder. But, the question
>> > is. Would it be possible to access the folder, using a script executed
>> > by the SYSTEM account, if I remove the permissions for the SYSTEM
>> > user?.

>>
>> > ==============

>>
>> > No, it isn't.

>>
>> Pegasus,
>>
>> Thank you very much for your help.
>>
>> Only one thinking... I don't understand why some antivirus software (I
>> have installed Symantec) is able to access folders with kind of
>> permissions. I suppose, the antivirus software has a way to bypass
>> NTFS security.
>>
>> Regards.
>>
>> ==================
>>
>> What makes you think that AV software can access folders that are beyond
>> the
>> reach of the System account?- Ocultar texto de la cita -
>>
>> - Mostrar texto de la cita -

>
> Because, If I scan for viruses in the "problematic" folder, the AV
> software doesn't complain about "Access Denied" error and the AV
> software says that certain number of files has beed scanned.


This is probably because it doesn't scan that folder! You can confirm this
easily by placing the industry-standard Eicar test virus file into your
folder. Read here how to create it:
http://www.eicar.org/anti_virus_test_file.htm


 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access to System Folders AJ Windows Vista General Discussion 4 09-12-2008 09:52 PM
Admin access to password protected regular user account dad1234 Windows Vista Administration 2 06-25-2008 01:01 AM
Unable to access protected folders on Buffalo Linkstation rfph1 Windows Vista Networking 8 09-06-2006 08:04 PM
Unable to access protected folders on Buffalo Linkstation rfph1 Windows Vista Networking 0 06-12-2006 06:01 PM
Access to System Folders? The Primate Windows Vista General Discussion 5 03-21-2006 04:41 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59