Restoring System Directories Permissions

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:

  1. create a reverse patch
  2. include only the permission changes
  3. 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

Sample Image



Related Topics



Leave a reply



Submit