I change file permitions of root - centos

I didn't check that I'm at root and I ran
chown www-data:www-data -R *
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
I don't have backup thats why I cant restore
all my website's goes 503 :(
The last thing that I saw on command was http://prntscr.com/oags7v before I scream
How can I recover the original ownership of the files and their permissions with chown and chmod?
thank you in advance & best regards...

At this point... first read The Tao of Backup. Better late than never.
Then, back up anything yours. Any apps you made, any data you have. Anything that is not OS.
Wipe the machine clean, reinstall OS. Reinstall any necessary software.
Put your data back, and chown them appropriately.
Make sure everything works.
Then see if you learned anything from The Tao of Backup. Reread as needed.

Related

Understand existing Postgres WAL archiving setup filling up the disk

New to a certain Postgres implementation done by someone else and need help figuring out an issue.
We have the following archive command configured, If I understand correctly then the archive command copies WAL files to a mounted storage /mnt/database:
archive_command = 'if { egrep -q " /mnt/database .* rw," /proc/mounts ;} && { ! pgrep test -u postgres ;} ; then test ! -f /mnt/database/%f && cp %p /mnt/database/%f ; else exit 1; fi'
We then have a cron job to move corrupted WALs out of the way:
find /mnt/database -type f -regextype posix-extended -regex ".*[A-Z0-9]{24}$" -mmin +60 -size -16777216c -exec logger "Trimming Postgres WAL Logs" \; -exec find /var/lib/pgsql/9.6/data/pg_xlog/{} -type f \; -exec mv {} {}.incomplete \;
The issue we are having is the /mnt/database keeps filling up and we need to extend the disk every few days. Is that because we have excessive WAL writing or too many corrupted WAL files ?
The live WAL in 'pg_wal' cleans itself up automatically. Your WAL archive, '/mnt/database/' here, does not. It is up to you to arrange for that to get cleaned up based on your organization's retention policy.
If your policy is to keep WAL forever, then you need to get enough storage space to do that. If you have some other policy, you would need to understand what it is (and describe it to us, if you want our help implementing it)
Neither of the commands you show seem to be related to retention.

Getting blank page after changing the deploy mode to developer

fresh installed Magento 2.2.3 with sample data everything worked fine. until I changed the deploy: mode to the developer. now it is showing a blank page, there is no error only blank screen.
refresh the cache, deleted all cache folders, generated folder and cleared pub/static folder too ( leaving .htaccess ) file. recompiled the code, ran setup upgrade commands but without any solution.
please help.
You can try enabling the developer mode to check the error(s) if any.
Also please try changing the permissions of the file and folder to the following:
from the root directory:
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;
chmod 777 ./app/etc
chmod 644 ./app/etc/*.xml
find ./var -type d -exec chmod 777 {} \;
find ./pub/static -type d -exec chmod 777 {} \;
You should enable exception printing by renaming local.xml.sample to local.xml in pub/errors. Also check exception and system log in var/log

Unable to determine status of lock file in the data directory

I am trying to run multiple mongod instances on the same centos machine with different config files.
I am getting following error while running the instance as a service:
sudo service mongod1 start
/var/lib/mongo1: boost::filesystem::status: Permission denied: "/var/lib/mongo1/mongod.lock"
I have added the permissions for the /var/lib/mongo1 using:
sudo chmod -R 600 /var/lib/mongo1
I also tried with 700, 755 and 777 at the end but nothing seems to work.
mongod:mongod is the owner of the folder /var/lib/mongo1
Any help is appreciated.
I know this is really late but I was struggling with this for days and just now found the fix. That being said for future users running into this issue the solution if you're using SELinux is to check the context of the default mongodb path against your own to make sure they are the same by executing
ls -dZ /var/lib/mongo/
the output should look something like this
drwxr-xr-x. mongod mongod system_u:object_r:mongod_var_lib_t:s0 /var/lib/mongo/
if it's not then you can copy it by doing
chcon -R --reference=/var/lib/mongo /your/path
the source can be found here
Maybe the lock file is missing? Which might explain why chmod isn't having the desired effect...
Try:
touch /var/mongo1/mongod.lock
chown mongod:mongod
chmod 600 /var/mongo1/mongod.lock
important :
Don't try to restart mongo using sudo as it tries to change the user to root where as /var/lib/mongodb owner is mongod:mongod
Please remember that Directories needs to have execute permission, but the files within the directories do not need to execute permission.
The following 2 commands worked for me
$ sudo chmod -R 770 /var/lib/mongo1
$ sudo find /var/lib/mongo1 -type f -exec chmod 660 {} \;
This will first give everything under /var/lib/mongo1 execute permission, and then return all the normal files to having only read and write, but not execute.

Sudo chown mistake?

I have been trying to install Homebrew on my Mac but ran into permission problems since my user is not an administrator.
I followed the suggestions here: https://stackoverflow.com/a/16450503/4909923
su -l admin
sudo chown -R "$USER":admin /usr/local
sudo chown -R $USER:admin /Library/Caches/Homebrew
Now I'm concerned that I have wrongfully changed the ownership of these folders to a specific user. Will it impact my normal user negatively?
changing ownership of /usr/local to a specific user is not a solution. It is a terrible hack and a workaround if you have a single user system. But then you might as well just chown -R / $USER:$USER – fijiaaron Jan 23
If this was a stupid thing to do, how do I restore it to normal?
It should probably look like the image with /lib/ which is another folder in /usr/, with system Read & Write and wheel Read Only.
It should probably look like this (another folder in /usr/):
I think the permissions I mentioned in the comment should be fine, but if you want to be sure everything is set at its default, you can uninstall Homebrew using this script and then reinstall it from scratch.
You can also follow this advice for resetting the permissions.

Apache 2 on Ubuntu shows 403 forbidden on certain urls

I have a Zend Framework application. Almost all of my urls work fine. However, any url that starts with /resources gives me a 403 forbidden error (e.g.: /resources/add, /resources/edit). The strange thing is, when I tested it on my Windows machine via XAMP, everything worked fine. Is there something special about urls starting with /resources that makes Apache2 think it should not allow access?
Your issue seems a permissions problem, nothing related to URLs. Check directories to be 755 and files 644 in the Ubuntu server where you deployed your application.
Run this in the root directory of your application and should get you going:
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;