Restoring System directories permissions
You can reset the permissions with all installed RPM packages, that should make most things work again.
for p in $(rpm -qa); do rpm --setperms $p; done
for p in $(rpm -qa); do rpm --setugids $p; done
Run as root.
Restore Permissions for IIS inetpub folder
The solution was to edit the permissions on the wwwroot folder so that user IIS_IUSRS had read/write permissions. I’m guessing that I accidentally overwrote all of the permissions on the folder when I shared it on my network.
Setting permissions to default on Windows 10 cmd line, icacls or similar?
Besides Property -> Security of a folder/file, another way to do this is using Get-Acl and Set-Acl
using PowerShell. Follow this guide: https://blogs.msdn.microsoft.com/johan/2008/10/01/powershell-editing-permissions-on-a-file-or-folder/
An easy way to see the Read/Write permissions on your files, I recommend this tool: https://learn.microsoft.com/en-us/sysinternals/downloads/accessenum
How to restore the permissions of files and directories within git if they have been modified?
Git keeps track of filepermission and exposes permission changes when creating patches using git diff -p
. So all we need is:
- create a reverse patch
- include only the permission changes
- apply the patch to our working copy
As a one-liner:
git diff -p -R --no-ext-diff --no-color \
| grep -E "^(diff|(old|new) mode)" --color=never \
| git apply
you can also add it as an alias to your git config...
git config --global --add alias.permission-reset '!git diff -p -R --no-ext-diff --no-color | grep -E "^(diff|(old|new) mode)" --color=never | git apply'
...and you can invoke it via:
git permission-reset
Note, if you shell is bash
, make sure to use '
instead of "
quotes around the !git
, otherwise it gets substituted with the last git
command you ran.
Thx to @Mixologic for pointing out that by simply using -R
on git diff
, the cumbersome sed
command is no longer required.
Saving and restoring ACLs
To answer my own question, I've found a program named AccessEnum that lists all the folders that have different permissions than the parent.
http://technet.microsoft.com/en-us/sysinternals/bb897332.aspx
This has allowed me to identify which folders need write or write/execute permissions and apply them by hand.
It's not ideal but the other alternative was also time consuming and somewhat complex.
Is it possible to create a script to save and restore permissions?
hm. so you need to
1) read file permissions
2) store them somehow, associated to each file
3) read your stored permissions and set them back
not a complete solution but some ideas:
stat -c%a filename
>644
probably in combination with
find -exec
to store this information, this so question has some interesting ideas. basically you create a temporary file structure matching your actual files, with each temp file containing the file permissions
to reset you iterate over your temp files, read permissions and chmod the actual files back.
Restore all DB backups in SQL Server
The issue related to folder permission, You need to set "everyone" with Full control to resolve this issue
Related Topics
How to Put All Command Arguments in One Variable
Error While Building Pjsip in Linux
Auto-Start Program at Login in Angstrom on Beagleboard
Sed: Remove Whole Words Containg a Character Class
Save The Result of Ls Command in The Remote Sftp Server on Local Machine
Using Ebpf to Measure CPU Mode Switch Overhead Incured by Making System Call
Getting The New Squeak 5 to Run on 64 Bit Linux
Maximum Number of Threads Allowed to Run
Ffmpeg Combining Images to Video and Streaming in One Command Line
The Behavior When a Gnu Make Phony Target Happens to Be The Same as a Directory Name
How to Add External References in Monodevelop
Run Meteor as a Daemon Process
How to Get Jenkins Working with Binaries from a Subfolder of The Root User
How to Determine from Where a Program Jumped to an Invalid Address - Without Single-Stepping
How to Enable or Configure Ftrace Module
Libnetfilter_Queue Programming, How to Know Which Program Send The Packet