Apache chown on its files not working


 
Thread Tools Search this Thread
Operating Systems Linux Red Hat Apache chown on its files not working
# 1  
Old 08-16-2016
Apache chown on its files not working

Hello,

My apache user generate one file :

Code:
# ls -lsa /tmp/reference_file.csv
76 -rwxrwxrwx  1 apache apache 69921 Aug 16 14:14 tmp/reference_file.csv

the user and the group belong to apache, but when i am trying to change it :

Code:
su -l apache -s /bin/bash
-bash-3.00$ whoami
apache
-bash-3.00$ chown explorer:btunix /tmp/reference_file.csv
chown: changing ownership of `/tmp/reference_file.csv': Operation not permitted

I tried to another folder, but the result was the same, I ve also checked attribut :

Code:
 # lsattr /tmp/reference_file.csv
 ------------- /tmp/reference_file.csv

there is no immutable attribut

How can I do ?

Thanks
# 2  
Old 08-16-2016
Do you have write permission on the directory?



Robin
# 3  
Old 08-16-2016
What's user apache's permissions on /tmp?
# 4  
Old 08-16-2016
I think apache get no restriction no ?

Code:
ls -lsa /
...
888 drwxrwxrwt   161 root    root   901120 Aug 16 15:12 tmp
...

# 5  
Old 08-16-2016
Quote:
Originally Posted by cterra
My apache user generate one file :

Code:
-bash-3.00$ chown explorer:btunix /tmp/reference_file.csv
chown: changing ownership of `/tmp/reference_file.csv': Operation not permitted

I tried to another folder, but the result was the same, I ve also checked attribut :
The man-page helps. From man chown:

Code:
       Only the root user can change the owner of a file. You can change the
       group of a file only if you are a root user or if you own the file. If
       you own the file but are not a root user, you can change the group only
       to a group of which you are a member.


Quote:
Originally Posted by cterra
How can I do ?
By becoming root.

I hope this helps.

bakunin
This User Gave Thanks to bakunin For This Post:
# 6  
Old 08-17-2016
Ok, I thought, I could have change the owner only if i am the owner.
# 7  
Old 08-17-2016
Quote:
Originally Posted by cterra
Ok, I thought, I could have change the owner only if i am the owner.
Allowing normal users to "give away" files would create HUGE security holes, and, on systems that charge users for the disk space they use, would allow you to change your files to world readable and writeable and have another user billed for your disk use while still having access to your data (even after you have given them away).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Apache not working

I have installed apache2 on ubuntu 16.00 and checked the logs and no errors apt list --installed | grep apache2 WARNING: apt does not have a stable CLI interface. Use with caution in scripts. apache2/xenial-updates,xenial-security,now 2.4.18-2ubuntu3.5 amd64 ... (0 Replies)
Discussion started by: DOkuwa
0 Replies

2. UNIX for Dummies Questions & Answers

Subdomain is not working, debian, apache

Hi, I use debian jessie, apache. I am not allowed to post links here at this forum, I am new user. I made subdomain porodin.predicsasa.com and it is working, vhost file is porodin.conf in /etc/apache2/sites-available then I copied vhost file and made it hosting.conf, did a2ensite hosting and it... (5 Replies)
Discussion started by: alanford
5 Replies

3. Linux

Apache/2.2.25 VirtualHost not working

I am having problems in implementing the virtual hosts here in my server. I have this one cloud dev server: Amazon Linux AMI release 2013.03 (based on RHEL like CentOS) with Apache 2.2.25 installed and I'm trying to create 2 virtual hosts: test-kalc.tk and test2-kalc.tk. If I go to... (2 Replies)
Discussion started by: jpdoria
2 Replies

4. Red Hat

Find and Chown all files in a DIR except for Root

RHEL 6.3 Could someone tell me how to use the find and chown command to replace all files in a directory owned by user1 (for this example) and replace with user1:group1? Most importantly I dont want to change any files owned by root. I recently used the following command but it changed the root... (4 Replies)
Discussion started by: gps1976
4 Replies

5. Shell Programming and Scripting

Chmod working in sudo run script but chown isn't

My git user has permission in sudoers to run a wrapper script to move files into my webroot. Everything is working fine except for the chown line. After the script has run, the files ar still root:root instead of apache:apache. Scratching my head...:confused: #!/bin/sh echo echo "****... (4 Replies)
Discussion started by: dheian
4 Replies

6. Web Development

Apache to Tomcat forwarding not working properly

Hi, I am facing some problem with Apache to Tomcat forwarding. I have Tomcat (6.0.18) behind Apache (2.2). I want to use ‘https' for receiving request from the client. This request, when forwarded by Apache to Tomcat, will use ‘http'. My application's name is ‘abc', which is deployed in... (1 Reply)
Discussion started by: Technext
1 Replies

7. Linux

chown files/directories for multiple computers

I have a flash drive this I store files on, but I need the whole drive to be password protected. I was thinking of making the drive root permissions, but I'm not sure if that will need the root password of the computer from which I transfered the files from or the root password of the computer I'm... (1 Reply)
Discussion started by: Texasone
1 Replies

8. UNIX for Dummies Questions & Answers

CHOWN Multiple Files

We have a test and training directory. The test is a copy of training. We need to change the ownership and group for a list of specific files from the training directory. Is there a way to feed the CHOWN command the list of files we need changed? We are performing the CHOWN as root. Thanks in... (4 Replies)
Discussion started by: Teganii
4 Replies

9. UNIX for Dummies Questions & Answers

cannot access files in apache

i've never had this happen before, but i cannot access files from the shell in my apache server but i can see them on my localhost and by typing in my ip address in the url i can access and view files. not through the shell tho.... kumi@throne:/var/www % ls -l templates/decorative total 0... (3 Replies)
Discussion started by: visitorQ
3 Replies

10. UNIX for Dummies Questions & Answers

Apache Config Files

Currently our Apache log files are huge, I want to put say a month's time limit on this, then when it hits the end of the month I would like it to start over writing. Does anyone know where the config file is for this and what its called? I also want to do exactly the same on wtmp config (who... (1 Reply)
Discussion started by: Webwitch
1 Replies
Login or Register to Ask a Question