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.
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
Answers (4)
Please log in to answer
Posted by:
vjaneczko
9 years ago
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
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
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
>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.
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.
fpr /F "tokens=*" %%J in (%temp%\Dirlist.txt) do icacls "%%J" /grant BUILTIN\Users:(m) - enthusiasm 9 years ago