Permission about apache files - linux

I have a really strange problem about the permission of Apache. When I copy a directory or file to /var/www/html and visit it from my browser, it says I don't have permission. But when I make a new directory or file with the exactly same name, path, owner, group and permission, I can visit it from my browser.
The owner of the file is root and the permission of it is -rw-r--r--. I used to try some more open permission but is doesn't work, too.
By the way, my system is centos 6.0.

Check for directory settings in apache config files. You can look for details here; http://httpd.apache.org/docs/current/mod/core.html#directory

Related

apache2 on ubuntu webserver rejects permission to access any other file than the delivered index.html

I am trying to set up a webserver running on Ubuntu. I have installed Apache and changed the root directory to an other directory within /var/www/. When I copy the index.html provided by Apache to that directory, I can access that file via remote webbrowser. But if I want to use a different index.html file, even really basic ones, I get an error: "Forbidden You don't have permission to access this resource". I have also tried to download that html, alter just a few lines and put it back on to the server with the result that it also shows that error. If I rename the initially provided index.html to index2.html I can still access it. I do not understand how it is possible that only this exact file is working.
I have tried to grant more permissions with Directory and restarted Apache but it won't work. I am rather new to Linux and Apache, can only use the terminal on my webserver and I do not know what else to do. Please help.
Change the permissions on the file, too, not just the folder. Pretty sure this fix it.
For diagnostic correction, allow permission for all by typing:
sudo chmod -R 777 /path/to/index.html

Symbolic link not allowed or link target not accessible

I have a folder somewhere on my webserver and a symlink to this folder from a public_html of another user. For the purpose of centralizing some content.
I can perfectly include files from within this symlinked folder.
However, I can not access a file (e.g. test.html or test.php) directly.
If I try to access a file directly I get a forbidden error in the browser and in the log files I see:
Symbolic link not allowed or link target not accessible
I have tried to edit the httpconf as I found on the internet, tried to put a .htaccess in the folder where the symlink recides etc. But nothing has helped so far.
Additional info:
My webserver runs CentOS release 6.5 (Final)
Apache 2.2.27
permissions to the parentfolder of the linked folder: 777
Permissions to the linked folder: 777
I have set them from 644 to 777 for testing purposes
And please note that I am a programmer running into problems, not a linux expert :)
*** I still do not have a working solution. I can use the files by including them, just fine, just not call any files directly e.g. images, stylesheets. I have no idea what other details to give that will help solve this problem.
The permissions are ok for the link, folder and parentfolder
Changing the owner of either link or folder does also not give any results
Options FollowSymLinks in .htaccess in the folder with the link, the parent of that folder, the destination folder and parent of destination folder, it does all not seem to help.
I can just not execute files and really need to
It turned out that the symlink itself needed to be owned by the same user as the original linked folder
chown -R username: linkname
That did the trick for me
You can check the rights with
ls -la
Then it looks a little wierd to see all the files owned by the actual user, except for the symlink, which is owned by the original user.
Hope this helps others with a similar issue as well!
first of all I would recommend to include some details in your question. E.g. the permissions of dirs and files would be helpful, what distro etc.
My crystal ball analysis:
- You web-server (apache) runs as user www-data
- Your php runs a suexec user A / user b.
- The www-data user, cannot access the file, because the permission for www-data is not sufficient on the file or it's parent dir (!).
You could do:
$ sudo -u www-data ls -lah /path/to/your/file
... to see, what your webserver users sees.
$ ls -lah /path/to/your/file
... to check, what permissons are set to the file. (group/world readable?)
$ ls -dlah /path/to/your
... to check the permissions on parent dir (need x flag for www-data),
HTH,
j.
In a <Directory> block in the Apache config, or in an .htaccess file:
Options FollowSymLinks

Default group permission for RStudio Server

I am using RStudio server (Version 0.98.994) on Ubuntu 12.04.
Our group works on a external share drive together and would like to open the same project.
When I open a project file created by other colleagues, I got an error with permission denied (Sorry I cannot show the error message as I already changed the permission manually).
After checking the file permission, I found the default permission is "-rw-r--r-x" for *.Rproj and .Rhistory, "drwxr-sr-x" for ".Rproj.user". So no write permission for group.
In the external share drive (no sure about system, should be Linux), the default permission is rw for group.
How could I change the default permission for *.Rproj, .Rhistory and .Rprojt.user?
Thanks for any advice. Please let me know if my question is not clear.
EDIT:
I created new file and folder in the external share drive from command line. The default permission is -rw-rw-r-- for file and drwxrwsr-x for folder, as I expected. It seems RStudio server created these new files with their own default permission.
Could I change the default permission of these files *.Rproj, .Rhistory and .Rprojt.user when RStudio server creates them? i.e. Add write permission to group.
The default permissions for Directories are 777 which is read/write/execute and for Files it is 666 which is read/write. But then every system has a umask value, which is normally 022.
So when you create a directory it will have permissions 777 but it will take away the umask value of 022 and leave you with your default permissions of 755 which is rwxr-xr-x
You can change the value of umask by simply entering the command
umask=055
This will set the umask value to 055 and whenever you create a new file/directory, 055 will be taken away from the permissions.
Again look at a newly created directory with permissions of 777 and the umask value is taken away so the directories permission is 722 which is rwx-w--w-
Again look at a new directory with permissions

Users can't upload files, even with permissions set to them using vsftpd

I have a cloud hosting linux solution. I had vsftpd working on it, but after having issues and tinkering with a lot of settings, I now have an issue where users can login using FTP and connect to the correct home directory, navigate within it, download files but they cannot upload files to the server. They get a time out error, which appears to be a permissions error, but I can't narrow it down any more than that. /var/logs/syslog gives nothing away.
The folders belong to the users. The parent www folder is set to 555. Can anyone help with this issue at all?
Cheers,
T
Try to set the permissions to 755, 555 doesn't allow writing for anyone. Are your user and group different?
You also may need to enable logging for FTP server. The time out error may include some other errors, not only permission denied.
To have extended logging change the variables in your ftp config file:
dual_log_enable=YES
log_ftp_protocol=YES
xferlog_enable=YES
syslog_enable=NO
and check the log file name there.
you must create a folder into user folder (Example : /var/www/user1/upload).
and set permission 777 (Example : chmod 777 /var/www/user1/upload).
then upload file into this folder.

How to allow file uploading outside home directory with SSH?

I'm running a Fedora 8 Core server. SSH is enabled and I can login with Transmit (FTP client) on port 22. When logged in, I can successfully upload files to the users home directory. Outside the home directory I can only browse files, not upload/change anything. How can I allow file uploading to a specific directory outside the users home directory?
an easy method is to grant the user rights to the folder you want them to be able to upload to, then add a symlink (link -s) from their home folder to the destination.
You can also just use
scp file user#server:/path
which will let you upload to any directory you have permissions to
file is the file to copy
user & server should be obvious
/path is any destination path on the server which you have rights to; so /home/user/ would be your likely default home folder
You need to make those directories writable by the proper users, or (easier) that user's group. This is of course a huge security hole, so be careful.
HI,
Give the FTP user write permission on the directory where you want to upload your files.

Resources