What permission do I need to edit a perl file on linux via Sublime - permissions

Somehow I've made an error where my Perl files, located on a Linux server, must be set at 775 for me to edit them via Sublime, on my Windows laptop.
I can change the files to 755 and they'll run properly, but I can't edit them unless they're set to 775. When I try to save them I get a Permission Denied error.
Everything is owned by www-data
drwxr-xr-x 2 www-data www-data 4096 Jun 10 08:00 cgi-bin
The Perl file within cgi-bin directory is as well
-rwxr-xr-x 1 www-data www-data 960 Jun 10 01:22 perly.pl
When I log in via the Sublime editor I log in as the original user I created my server with "danny", and he is a member of the www-data group.
Can anyone figure out where I making a mistake or the wrong assumption?

Related

SSH/Fuse mount create file ok but can't delete it

I have a proxmox server so under debian, and I want to mount a remote directory from my Nas Synologies to make backups.
I normally use ssh mounts without any problem.
But this time I have an error that I have never encountered, I can create files, but not delete them.
I find this very strange and I don't see where this can come from
root#proxmox:/mnt/# sshfs user#192.168.0.1:home/data /mnt/dist-folder/ -o reconnect,
ServerAliveInterval=60,ServerAliveCountMax=30,allow_other,
default_permissions,uid=0,gid=0,umask=007
root#proxmox:/mnt# cd dist-folder/
root#proxmox:/mnt/dist-folder# touch aa.txt
root#proxmox:/mnt/dist-folder# ls -la
total 12
drwxrwx--- 1 root root 114 Mar 13 09:53 .
drwxr-xr-x 7 root root 4096 Mar 13 09:37 ..
-rwxrwx--- 1 root root 0 Mar 13 09:53 aa.txt
root#proxmox:/mnt/dist-folder# rm aa.txt
rm: cannot remove 'aa.txt': Permission denied
With uid=0,gid=0 for root user and group
Thanks
This is finally a problem specific to synology.
For the assembly of the file it is absolutely necessary to respect the path by starting with
/homes/<user>home/
So it's give
sshfs user#192.168.0.1:/homes/proxmox/home/data /mnt/dist-folder/
And it's works fine !
It's not the first time that I have an abnormal configuration for this synology tool... AGrrrr

Permissions for webcam access through Apache

I am trying to capture an image through a webcam and display it on a webpage but I am getting "permission denied errors"
I am running apache with the following user/group
/etc/apache2/envvars :
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
In the html code i have the request:
myRequest.open("GET", "/cgi-bin/getImage1.cgi", true);
myRequest.send();
In /usr/lib/cgi-bin I have the file: getImage1.cgi
#!/bin/bash
rm image1.jpg
fswebcam -r 640x400 --no-banner --deinterlace -q -d /dev/video0 --jpeg 95 image1.jpg
The file and directories permissions are:
In /usr/lib drwxrwxrwx 2 root www-data 4096 May 14 19:37 cgi-bin
In /usr/lib/cgi-bin -rwxr-xr-x 1 www-data www-data 115 May 14 18:51 getImage1.cgi
In /dev crw-rw----+ 1 root video 81,0 May 14 18:02 video0
User www-data is a member of the following groups:
$ id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data),44(video)
When i run the web page i get the following error code:
rm: cannot remove 'image1.jpg': No such file or directory
Error opening device: /dev/video0
open: Permission denied
Unable to find a source module that can read /dev/video0.
End of script output before headers: getImage1.cgi,
The error implies that it is executing the script but that the user does not have sufficient permissions to access the /dev/video0.
The apache user should be www-data which is a member of both www-data and video groups, so it should have access to the /usr/lib/cgi-bin directory, getImage1.cgi file, and the /dev/video0 webcam.
If I execute the script from the console it runs fine.
I would appreciate if anyone can offer suggestions.

File Upload / Strange Permissions Issue

I have a site that's been running for a while. All was going well. Until now. Dun duunnn dunnnnn.
I am unable to upload from an attachment field to a particular directory. But I can upload to that directory.
Desired directory to upload (does not work):
/sites/default/files/resources/case-studies
4 drwxrwxrwx 2 apache apache 4096 Jul 22 2013 case-studies
Uploading DOES work to the parent directory:
/sites/default/files/resources
4 drwxrwxrwx 10 apache apache 4096 Mar 18 10:15 resources
As far as I can tell they are identically permissioned. Is there something I am missing?
Thanks, hive mind!
steve
For reasons I haven't figured out, this works: chmod -R a+w files <----- yay! This make sense to me, but I really can't figure out why that would work and not : chmod -R 777 files <----- boo!

Ubuntu Unable to change permisions on windows partition disk

I need to change permissions of files in my /media/MAVEN/Projects
MAVEN is my windows disk partition.
The permissions on the Projects folder are:
:/media/MAVEN/Projects$ ls -la
\total 340
drwxrwxrwx 1 root root 12288 Oct 6 21:31 .
drwxrwxrwx 1 root root 32768 Oct 9 06:32 ..
all the projects are set to drwxrwxrwx
I need to change them to 755 so I tried:
~$ sudo chmod 755 -R /media/MAVEN/Projects
But I get errors: ...Read-only file system
The result of ls -la /media/MAVEN/Projects remains the same.
Help me resolve this.
Problem solved. I found out that I was using a package that was mounting my disk as read only. Its called pysdm I disabled that feature.

How to set up crontab permissions to be readable by apache

I have a django application which should read and write to a crontab. However if I create the file with this:
sudo su www-data
crontab -e
I can see that:
# ls -la
total 12
drwx-wx--T 2 root crontab 4096 Aug 13 16:28 .
drwxr-xr-x 5 root root 4096 May 1 2012 ..
-rw------- 1 www-data crontab 202 Aug 13 16:28 www-data
However the file is still not readable and writeable by django. If I switch with sudo to www-data user I can't edit the file. How to setup the permissions properly?
You are not allowed to read that dir, for good reason.
You can however:
Read the file with crontab -l
Replace the crontab with crontab /path/to/file/which/will/replace/it.
So a workable solution would be:
Store current crontab -l in some tempfile.
Do you modifications on that tempfile
Install that tempfile with crontab /path/to/tempfile
The reason is in man cron:
Users are not allowed to edit the files under that directory
directly to ensure that only users allowed by the system to run periodic tasks can add them, and only syntactically correct crontabs will be written
there. This is enforced by having the directory writable only by the crontab group and configuring crontab command with the setgid bid set for that
specific group.