Which files do control the visibility of your website? - unix

I run the following command at uni to my user account
chmod -R 700 *
Then, I run
chmod -R 755 public_html
My homepage remains to be "Forbidden" when I browse to it.
The permissions of my user account
4 drwx------ 5 Newbie staff 4096 2008-12-19 12:39 Desktop
4 drwx------ 10 Newbie staff 4096 2009-04-16 02:28 Documents
4 drwx------ 4 Newbie staff 4096 2008-11-28 20:48 irclogs
4 -rwx------ 1 Newbie staff 1686 2008-09-10 16:00 kieli
4 drwxr-xr-x 3 Newbie www 4096 2009-04-16 02:14 public_html
4 drwx------ 2 Newbie staff 4096 2008-09-01 08:43 Templates
4 drwx------ 4 Newbie staff 4096 2008-12-21 03:15 tmp
4 drwx------ 7 Newbie staff 4096 2008-09-03 21:39 Windows
4 drwx------ 4 Newbie staff 4096 2008-10-03 16:29 workspace
The permissions of files in public_html
4 -rwxr-xr-x 1 newbie staff 3414 2009-04-15 02:23 index.html
4 -rwxr-xr-x 1 newbie staff 2219 2008-09-16 10:46 index.html~
144 -rwxr-xr-x 1 newbie staff 140120 2009-04-14 22:16 jquery.js
4 -rwxr-xr-x 1 newbie staff 699 2009-04-15 01:05 template.css

Well, your second chmod doesn't seem to be working very well, since your public_html directory is mode 744, not 755.
You'll also need to make it so that your home directory can be "looked through" by the Web server; www user needs execute permission on the directory. chmod o+x . is probably your best bet.

Do you have an index file in the directory?

You would also need to give excute permission to the files in public_html. In the statement you are giving permissions chmod -R 755 public_html, still the permissions given is only 744. So give the execute permissions as well.

I found another bug.
My user folder had the permissions 700.
I changed it to 701.
I can now see my website.
It seems that 701 is required.

Related

Wordpress can't upload photos to wp-content

Running php on my Ubuntu box
The PHP process runs under my current user account named tiger
Below are the file permissions for the wp-content folder
drwxr-xr-x 15 tiger www-data 4.0K Apr 23 10:16 wp-content
When the Wordpress blog editor tries to upload photos through the Wordpress dashboard, they are presented with below error
Below is the file hierarchy for WordPress showing file permissions.
root-site-directory/ drwxr-xr-x 15 tiger www-data
`-- wp-content drwxr-xr-x 15 tiger www-data
`-- uploads drwxr-xr-x 15 tiger www-data
`-- 2022 drwxr-xr-x 15 tiger www-data
`-- 04 drwxr-xr-x 15 tiger www-data
What am I missing ?

A user can't read file but belong to the group

I have a strange issue on my debian vm.
I have a nginx directory like that.
$ ll
total 9076
-rw-r----- 1 www-data adm 330645 juil. 13 10:40 access.log
-rw-r--r-- 1 www-data root 143902 juil. 12 01:08 access.log.1
-rw-r----- 1 www-data adm 852976 juil. 13 10:41 error.log
I try to read the access.log with the foo user.
So, I have added this user to adm group.
$ cat /etc/group | grep adm
adm:x:4:admin,foo
But the user can't read the file. I have tried to add the user to www-data group, but the problem is the same. Do you know what is the problem ?
I thought know how user/group works, it seems not :)
BR,
Eric
To read a file, the user needs execute privileges to all of the parent directories. If your logs are in /var/log/nginx make sure the foo user or one of its groups has x access to each directory (/var, /var/log/, /var/log/nginx) of whatever path logs are in.

How can I move a theme directory to a remote with putty ftp? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I tried this:
Directory of C:\Program Files (x86)\PuTTY
05/21/2015 12:00 AM <DIR> .
05/21/2015 12:00 AM <DIR> ..
05/21/2015 12:00 AM <DIR> sahifa
14 File(s) 3,793,924 bytes
3 Dir(s) 22,940,766,208 bytes free
psftp> put -r sahifa
/var/www/html/myblog/wp-content/themes/sahifa: create directory: permission deni
ed
psftp>
But it gave me a permission denied.
Here's the directories.
[ec2-user#ip-172-31-34-160 wp-content]$ ls -al
total 20
drwxr-xr-x 4 nobody 65534 4096 May 7 01:45 .
drwxr-xr-x 5 nobody 65534 4096 May 19 06:47 ..
-rw-r--r-- 1 nobody 65534 28 Jan 8 2012 index.php
drwxr-xr-x 3 nobody 65534 4096 May 7 01:45 plugins
drwxr-xr-x 5 nobody 65534 4096 May 7 01:45 themes
I tried this but it does not seem to work:
[ec2-user#ip-172-31-34-160 wp-content]$ [ec2-user#ip-172-31-34-160 wp-content]$ chmod 777 themes
[ec2-user#ip-172-31-34-160 wp-content]$ chmod: changing permissions of ‘themes’: Operation not permitted
I also tried this:
drwxr-xr-x 4 nobody 65534 4096 May 7 01:45 .
drwxr-xr-x 5 nobody 65534 4096 May 19 06:47 ..
-rw-r--r-- 1 nobody 65534 28 Jan 8 2012 index.php
drwxr-xr-x 3 nobody 65534 4096 May 7 01:45 plugins
drwxr-xr-x 5 nobody 65534 4096 May 7 01:45 themes
[ec2-user#ip-172-31-34-160 wp-content]$ chmod -v 746 themes
chmod: changing permissions of ‘themes’: Operation not permitted
failed to change mode of ‘themes’ from 0755 (rwxr-xr-x) to 0746 (rwxr--rw-)
Can someone give me some advice as to what I should be doing? Is the problem maybe related to the fact that everything seems to be owned by "nobody" ?
Your current user ec2-user does not have permission to move or create files as current directory is owned by nobody:65534. If you have sudo access, put sudo at the beginning of your chmod command.
PS: chmod 777 is never a good idea. You might want to check what is group 65534, and add yourself to that group instead.

Unable to extract tar file - tar: extract not authorized

I am working on Solaris 10 machine. In that i cannot able to untar my file. Logs are given below. Anyone please suggest what may be the issue? I can able to create tar file but unable to untar. :(
bash-3.2# ls -lrth ConfigCheck-120614-KL.out*
-rw-r--r-- 1 root root 144K Jun 12 17:15 ConfigCheck-120614-KL.out
-rwxrwxrwx 1 root root 146K Jun 16 16:49 ConfigCheck-120614-KL.out.tar
bash-3.2# tar xvf ConfigCheck-120614-KL.out.tar
tar: extract not authorized
bash-3.2# tar tvf ConfigCheck-120614-KL.out.tar
-rw-r--r-- 0/0 147377 Jun 12 17:15 2014 ConfigCheck-120614-KL.out
Solaris 11 tar will fail with that error message if you are running as uid 0 but do not have the Media Restore profile set up in the RBAC configuration.
Unless you're trying to restore from backup, you should normally be untarring files as a normal user, not root, to avoid accidentally overwriting critical system files.

403 Error on Stylesheet - Raspberry Pi Webserver

I keep seeing a 403 error for my stylesheet which is hosted on my Rasberry Pi (webserver). I ran ls -al and this is the result:
pi#raspberrypi ~/www $ ls -al
total 16
drwxr-xr-x 2 pi root 4096 Mar 17 20:18 .
drwxr-xr-x 12 root root 4096 Mar 15 16:44 ..
-rw-r--r-- 1 pi root 644 Mar 17 20:18 index.html
-rw------- 1 pi root 329 Mar 17 20:19 stylesheet.css
The index.html data shows up when I point my browser at the ip, but there is no formatting and whenever I try to acess the css file through looking at the source code it keeps telling me theres a 403 error :(
Can anyone help a brother out??
Cheers!
You need proper permissions for the www folder, and that depends on which webserver you are running. For apache on debian the user is www-data, if your webroot is ~/www and you are user pi try these commands
Change owner to apache user recursively
Change Permissions to read for all recursively
chown -R www-data:www-data /home/pi/www
chmod -R 644 /home/pi/www

Resources