I'm trying to set a small webserver for personal use. I have a fodler /srv/http/cgi-bin/ which I want to edit as user and not superuser. I tried to chmod it as mentioned here. Here is the result:
sudo chmod 755 /srv/http/cgi-bin/ -R
[yotam@myhost ~]$ echo "h" >> /srv/http/cgi-bin/h.py
bash: /srv/http/cgi-bin/h.py: Permission deniedEdit:
Here is some data due to the comments and answers:
[yotam@myhost ~]$ sudo chmod 760 -R /srv/http/cgi-bin
Password:
[yotam@myhost ~]$ echo "hh" >> /srv/http/cgi-bin/h.py
bash: /srv/http/cgi-bin/h.py: Permission denied
[yotam@myhost ~]$ ls -ld /srv/http/cgi-bin
drwxrw---- 2 root root 4096 May 20 15:54 /srv/http/cgi-binAlso, the server is Ubuntu desktop running apache2. As far as I can tell, I didn't temper with any of the user settings so it all should be the default parameters
52 Answers
The mode string seems wrong. The mode string 755 means that
- The owner of the file can read (4), write (2) and execute (1) - 4+2+1 = 7
- Any member of the file's group can read (4) and execute (1) - 4+1 = 5
- Anyone else can read (4) and execute (1) - 4+1 = 5
It looks like you want chmod -R 766 /src/http/cgi-bin, but this seems like a very unsafe permission setting...
you can temporarily change the ownership to yourself , edit the file and change it back.
sudo chown -R yotam /srv/http/cgi-bin/ edit file (as user, not superuser as you required)
sudo chown -R root /srv/http/cgi-bin/ 2