/build/static/layout/Breadcrumb_cap_w.png

Setting Permissions

Hi 

I need help in setting permissions to files. I need to collect all files in %temp% and log them to a files.txt file and then need to change permission in files.txt and set it back to its original permissions.

any help is appreciated.

1 Comment   [ + ] Show comment
  • I got it I used the below cmd lines and it worked for me thanks all for your suggestions.

    fpr /F "tokens=*" %%J in (%temp%\Dirlist.txt) do icacls "%%J" /grant BUILTIN\Users:(m) - enthusiasm 9 years ago

Answers (4)

Posted by: vjaneczko 9 years ago
9th Degree Black Belt
0

Your request is a bit confusing.  Users have R/W access to the temp folder, so what has to be changed?  If you need to change file permissions from a CMD window, look into the ATTRIB command.

If you need to create a TXT file which contains the list of files in the folder, simply redirect the output of a DIR command into a file like so:

DIR *.* > %TEMP%\DirList.txt




Comments:
  • Yes you are right Users folder have R/W access but when I scan some users folder in our organization and we came to know that some of the files in %temp% folder does not have R/W access to other users except the users who created. so in order to modify that file I need to take over the rights on those files. So the first answer I got
    I can direct the output by this CMD DIR *.* > %TEMP%\DirList.txt and then how I can I change permissions in DirList.txt and then set it back to its original permissions. - enthusiasm 9 years ago
Posted by: anonymous_9363 9 years ago
Red Belt
0
If, by "permissions", you mean the ACLs, there are no native commands to deal with those. Obtain and use either SubInACL or, as I prefer, SetACL.

Comments:
  • How can I setACL to all the files which are in only %TEMP%\DirList.txt - enthusiasm 9 years ago
  • iCacls? - jagadeish 9 years ago
    • can you give an example how to set modify permission in "%temp%\DirList.txt'
      NOTE: need to give permission to the files which are in DirList.txt and not to DirList.txt - enthusiasm 9 years ago
Posted by: jaybee96 9 years ago
Red Belt
0
Capture this with RayPack , RayPack has the ability to capture Permission Changes on the target machine.
Very easy because you can now first make sure the permissions are set correctly and then finalize the capture.


download a free evaluation here: https://raypack.raynet.de/en/contact 

JB
Posted by: anonymous_9363 9 years ago
Red Belt
0
>How can I setACL to all the files which are in only %TEMP%\Dirlist.txt?

You need to create a script but why bother, when your command line lists all files, i.e. *.*? And why do you need to change permissions back? Used correctly, SetACL adds the specified account to the ACL, it doesn't replace the existing permissions.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ