Jump to content
Sign in to follow this  
BigNoter

ICAcLs & TakeOwn Command Line

Recommended Posts

BigNoter

Hi all,

 

I'm trying to do the following steps:

 

1. Ask the user to select a File from a dialog window "Open" (save its original owner and permissions) and also a UserName from the dialog window "Select User or Group" and grant the ownership and full access of the File to the UserName.

 

2. Wait for the user to finish accessing the File.

 

3. Automatically return the original owner and permissions (the one that saved in step 1) back to the File.

 

Using the following commands:

 

TakeOwn /F "full path of the File"

 

ICAcLs "full path of the File" /Grant "UserName":F

 

ICAcLs "full path of the File" /SetOwner "original user"

 

ICAcLs "full path of the File" /Grant:R "original user":RX

 

 

Any help will be appreciated.  :idea:  :idea:  :idea: 

 

TIA

Share this post


Link to post
Share on other sites
orbs

DIR /Q will give you the owner; but if you are not the owner and you have no access to the file, then you may have difficulty to restore the ownership after you've taken it (i have not tried it),

this is a good summary for ICACLS (the lettercase is flexible, but if you insist, then at least the middle ACL must be uppercase ;) )

http://ss64.com/nt/icacls.html

anyway, where are you stuck with your script?

Share this post


Link to post
Share on other sites
BigNoter

DIR /Q will give you the owner; but if you are not the owner and you have no access to the file, then you may have difficulty to restore the ownership after you've taken it (i have not tried it),

this is a good summary for ICACLS (the lettercase is flexible, but if you insist, then at least the middle ACL must be uppercase ;) )

http://ss64.com/nt/icacls.html

anyway, where are you stuck with your script?

Thanx for the quick reply.

The 4 commands line with its sequence, will do the job exactly the way I wonted (in DOS prompt) with no error or conflict in ownership!

ACL = Access Control List

ICAcLa = Inegrated Control Access List  B)

I did not yet started with the script! May be someone has it laying somewhere in his archive. I think I have to get rid of my old dusty AutoIt information and start the coding..! :ph34r:

Share this post


Link to post
Share on other sites
orbs

The 4 commands line with its sequence, will do the job exactly the way I wonted (in DOS prompt) with no error or conflict in ownership!

 

happy for you. did you test on files that are not accessible to you? i find this is the main issue with ownership - users take ownership and revoke admin rights on files and folders... very annoying.

I did not yet started with the script! May be someone has it laying somewhere in his archive. I think I have to get rid of my old dusty AutoIt information and start the coding..! :ph34r:

 

look up RunWait() in AutoIt help.

Share this post


Link to post
Share on other sites
BigNoter

look up RunWait() in AutoIt help.

 

Thanx for the jump start.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×