Cannot write in logs folder even after correct permissions - laravel-5.5

I am getting the error The stream or file "/opt/lampp/htdocs/project/storage/logs/laravel-date.log" could not be opened: failed to open stream: Permission denied
I have tried setting the permissions as both 777 and 775. I suddenly started getting this error. Here's the ls -l output of the project.
drwxrwxr-x 15 root www-data 4096 Dec 2 2018 project
I am using XAMPP for my current development environment and not the native LAMPP stack.

Okay, so I read through a comment in here and changed my directory permissions to 777 for app and public folders. 775 for storage and the rest is 664. And it worked.

Related

cifuzz/jazzer docker image missing a jar?

First time trying out cifuzz/jazzer but I am unable to get the source code from github without circumventing my organisation's restrictions on downloading external code (and risking their wrath). Fortunately, I can download and use the cifuzz/jazzer docker image. However all roads lead this error:
ERROR: Could not find jazzer_standalone.jar. Please provide the pathname via the --agent_path flag.
Obviously, I'm no jazzer expert, nor am I too seasoned with docker beyond the (very) basics, however by overriding the entrypoint of the image with:
docker run -it --entrypoint /bin/sh cifuzz/jazzer
and navigating to the /app directory where these files exist:
/fuzzing # cd /app/
/app # ls -alrt
total 10192
-r-xr-xr-x 1 root root 9764956 Oct 24 21:09 jazzer.jar
-r-xr-xr-x 1 root root 658288 Oct 24 21:09 jazzer
drwxr-xr-x 2 root root 4096 Oct 24 21:09 .
drwxr-xr-x 1 root root 4096 Nov 6 16:54 ..
Running ./jazzer results in the same error seen when trying to start the app through the instructions on the github page.
ERROR: Could not find jazzer_standalone.jar. Please provide the pathname via the --agent_path flag.
Looking in the github repo online in the search facility for "jazzer_standalone.jar", it finds this code in the BUILD.bazel file on line 34:
remap_paths = {
"driver/src/main/java/com/code_intelligence/jazzer/jazzer_standalone_deploy.jar": "jazzer_standalone.jar",
"launcher/jazzer": "jazzer",
},
Seems that jazzer_standalone_deploy.jar isn't remapped and/or included in the image?
From the github instructions at https://github.com/CodeIntelligenceTesting/jazzer it says:
The "distroless" Docker image cifuzz/jazzer includes Jazzer together with OpenJDK 11. Just mount a directory containing your compiled fuzz target into the container under /fuzzing by running:
docker run -v path/containing/the/application:/fuzzing cifuzz/jazzer <arguments>
I tried:
docker run -v path-to-my-applicatiuon-jar:/fuzzing cifuzz/jazzer
So I missed out the arguments, just to get some error output and see if I had got the volume path correct, etc.
The result is:
ERROR: Could not find jazzer_standalone.jar. Please provide the pathname via the --agent_path flag.
This has been fixed in Jazzer and new images have been pushed: https://github.com/CodeIntelligenceTesting/jazzer/issues/524

Singularity - Centos7 - Permission

i use singularity on Centos7 system, but i block on incomprehensible like-permission problem.
(It's a centrifuge/recentrifuge container made by myself that perfectly working on Ubuntu system)
command
singularity exec /HOMEPATH/Singularity/centrifuge_recentrifuge.simg centrifuge -x /HOMEPATH/Centrifuge/bacteria-database-centrifuge -1 /HOMEPATH/work_directory/centrifuge_recentrifuge/reads/TTOTO_R1_001.fastq.gz -2 /HOMEPATH/work_directory/centrifuge_recentrifuge/reads/TOTO_R2_001.fastq.gz -S /HOMEPATH/work_directory/centrifuge_recentrifuge/classification_result --report-file /HOMEPATH/work_directory/centrifuge_recentrifuge/classification_summary
 error log
Error: Could not open alignment output file /HOMEPATH/work_directory/centrifuge_recentrifuge/classification_result
Error: Encountered internal Centrifuge exception (#1)
Command: /usr/local/bin/centrifuge-class --wrapper basic-0 -x /HOMEPATH/Centrifuge/bacteria-database-centrifuge -S /HOMEPATH/work_directory/centrifuge_recentrifuge/classification_result --report-file /HOMEPATH/work_directory/centrifuge_recentrifuge/classification_summary -1 /tmp/229778.inpipe1 -2 /tmp/229778.inpipe2
(ERR): centrifuge-class exited with value 1
It's seeem like singularity can not write the tmp files or write the classification_result file or the both :/
work directory permission
ls -Z /HOMEPATH/work_directory/centrifuge_recentrifuge/
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 reads
ls -Z /HOMEPATH/work_directory/centrifuge_recentrifuge/reads/
-rw-r--r--. root root system_u:object_r:httpd_sys_content_t:s0 TOTO_R1_001.fastq.gz
-rw-r--r--. root root system_u:object_r:httpd_sys_content_t:s0 TOTO_R2_001.fastq.gz
EDIT 1 Resolve Permission Problem
ls -Z centrifuge_recentrifuge
drwxr-xr-x. apache apache system_u:object_r:httpd_sys_content_t:s0 reads
ls -Z centrifuge_recentrifuge/reads/
-rw-r--r--. apache apache system_u:object_r:httpd_sys_content_t:s0 TOTO_R1_001.fastq.gz
-rw-r--r--. apache apache system_u:object_r:httpd_sys_content_t:s0 TOTO_R2_001.fastq.gz
And the error is still the same...
I have make a sudo chown -R apache:apache /tmp on the tmp folder but it's does not make effect :/
ls -Z /HOMEPATH/work_directory/centrifuge_recentrifuge/
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 reads
This says that the only the owner of the centrifuge_recentrifuge directory has permission to create items in that directory, and that the owner of the directory is the user root. So, only root can create items in that directory.
Presumably you were not running the singularity program while logged in as root and that's why the program was unable to create a classification_result file. It wouldn't have been able to create a classification_summary file either, if it had got as far as trying to do that.
I don't know if you have a special reason for having this directory owned by root. If you do, then the only way the program is going to be able to create these files is if you run it as the root user. Of course it's generally a bad idea to use the root account for anything other than system administration.
The usual approach is to have the HOMEPATH directory, and everything below it, be owned by the individual (non-root) user for whom that particular HOMEPATH was created. In this model, that individual user would be the owner of the centrifuge_recentrifuge directory, and therefore if you run the singularity program when logged in as that user it will be able to create whatever files it needs there.
To get to that situation from where you are now, to change the ownership of HOMEPATH and everything beneath it you can log in as root (or use sudo) and then run:
chown -R myuser /HOMEPATH
where myuser is the username of the account that has HOMEPATH as its home directory.
That should be enough to let the program run. However, for completeness you should also change the group ownership of HOMEPATH and everything beneath it to match the individual user's group. To do that, run:
chown -R myuser:mygroup /HOMEPATH
where mygroup is the group that contains the user myuser. If you don't know what that group name should be, log in as myuser and run the id -ng command. It's common to have the group name be the same as the user name, so don't be surprised if the result of that id command is the same as myuser. On some systems you can run:
chown -R myuser: /HOMEPATH
with just a colon : after myuser and the command will figure out the group name for you. If that works on your system then you don't need to do the id -ng dance.

Permission denied for image upload on Django rest wsgi with apache2

Main problem
When user uploads image to the rest admin portal, permission error is thrown. The backend model is a simple one with only ImageField and TextField.
My setup
Ubuntu 16.04 LTS
Python 3.6
Apache2 with mod_wgsi compiled for python3.6
The upload destination is owned by my account and wwwdatagroup(I created this group for www-data and grant 760 on the upload destination)
Here is the output of ls -l This folder is under my home directory, the image is uploaded to a subfolder of media folder.
drwxrw---- 3 MYUSERNAME wwwdatagroup 4096 Jul 30 17:48 media
This was set by chmod -R 760 media I suppose this will set the permission recursively.
Question
My wsgi process has no specific user set, so it should run under the user which apache is running on. In my case www-data. As shown above, obviously this folder and all is subfolders can be read, written(rw) by wwwdatagroup which contains www-data. So WHY PERMISSION DENIED?
Help...
I am staring at the error page and crying. Real tears.
I solved this problem by setting 770 for wwwdatagroup on the media folder. My guess is that Django is doing some listing(require x permission) or trying to mkdir(this requires x too? I don't know).
I will keep this question open and will give the accepted answer to person who explains this well. Thanks!

Unable to edit Redis.conf file in ubuntu 16.04 LTE?

I installed Redis in Ubuntu 16.04 LTE and during configuration i have to edit redis.conf file, but unfortunately i could not be able to save the file, because file is having read-only access
-rw-r--r-- 1 root root 46695 Jan 18 19:57 redis.conf
I used chmod 777 redis.conf to get the access writes but it is not happening
chmod: changing permissions of 'redis.conf': Operation not permitted
Thanks in advance for your valuable solution
Operation not permitted is an error thrown when the user through which you logged in doesn't have permission, following should work if you have sudo privileges.
sudo vi redis.conf
OR
sudo nano redis.conf
OR
sudo gedit redis.conf
Choosing editor is based on your personal preferences.

Django uploading file - permission denied

I've tried everything that i've found regarding this problem, but nothing helped me to solve this issue.
When i try to upload something on my web site i get this error:
OSError: [Errno 13] Permission denied: '/home/****/www/site.com/media/news/some_file.pdf'
ls -l media gives me next:
drwxrwxr-x 2 www-data www-data 4096 Oct 11 23:13 news
so permissions are OK.
Everything was working well with development server but now in production i just cant upload anything.
How to fix this?
As a noob for linux/apache I didn't know that default user for apache in CentOS (that i'm running on my server) is apache and not www-data.
So chown -R apache:apache media did the trick.
In last few days i've searched a bunch of topics regarding this problem and none of them did mention that there's other default user but www-data. It looks like that most of users are runing Ubuntu as everyone is talking about www-data.