Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Member
    Join Date
    Oct 2006
    Posts
    11

    Default Deny Permission to delete/edit files like .htaccess?

    Is it possible to deny access for files like .htaccess or even certain .php files for cPanel users?

    I don't want some accounts to have the permission to change .htaccess or remove some files in their public_html folder.

  2. #2
    Member
    Join Date
    May 2004
    Posts
    13

    Default

    What kinds of files within their public_html folder?
    If you have specific rules that you don't want them to change within their .htaccess, define them within the apache configuration file(s), or place a .htaccess directly in /home (note, the latter option might cause load increase).

    If you want to disable user-land .htaccess files, you can do this in the apache configuration files as well.

    I guess a better question is: What are you trying to accomplish? What's the situation that caused this question to come up..?

  3. #3
    Member
    Join Date
    Oct 2006
    Posts
    11

    Default

    I added this into the .htaccess of some users and now I don't want them to remove or alter the file. As I cannot move the ad.php to another directory above the users because open_basedir is enabled I'd like to protect this one too.

    Putting the .htacess into /home would cause every user to apply this file, right? But as I don't want every user to have this forced ads this is not a solution for me.

  4. #4
    Member
    Join Date
    Jan 2005
    Location
    London, UK
    Posts
    187

    Default

    What about using chown so as these files are owned by root, hence user cannot modify?

    - Vince

  5. #5
    Member
    Join Date
    Oct 2006
    Posts
    11

    Default

    Is it possible to have the owner of these files changed automatically on account creation?

  6. #6
    ujr
    ujr is offline
    Member
    Join Date
    Mar 2004
    Posts
    294

    Default

    you could try putting them in the in the accounts skeleton directory and chowning them to root:root

  7. #7
    Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    300
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    chattr +i /path/to/.htaccess will make the file non modifiable
    Marie - Co-Owner
    Need Further Assistance ? Here you go !
    English, french and spanish support

  8. #8
    Member
    Join Date
    Oct 2006
    Posts
    11

    Default

    chattr: Inappropriate ioctl for device while reading flags on /root/cpanel3-skel/public_html/.htaccess

    Thats not gonna work.


    Quote Originally Posted by ujr View Post
    you could try putting them in the in the accounts skeleton directory and chowning them to root:root
    I tried that but the user still can edit everything.
    Last edited by BG06; 10-28-2006 at 08:48 AM.

  9. #9
    Member
    Join Date
    Dec 2003
    Location
    France
    Posts
    300
    cPanel/Enkompass Access Level

    Root Administrator

    Default

    You would need to chattr +i once the .htaccess is in place in your customer account.
    Marie - Co-Owner
    Need Further Assistance ? Here you go !
    English, french and spanish support

  10. #10
    Member
    Join Date
    Oct 2006
    Posts
    11

    Default

    It doesn't matter where the file is I always get the same output.

  11. #11
    Member
    Join Date
    Oct 2006
    Posts
    11

    Default

    I still couldn't find a solution for the permissions

  12. #12
    BANNED
    Join Date
    Jun 2005
    Location
    Wild Wild West
    Posts
    2,025

    Default

    Instead of putting commands in .htaccess that you don't want the user to change,
    put them in the VirtualHost section of /etc/httpd/conf/httpd.conf for the site(s)
    you want those commands added.

    If you are trying to do this for all sites, you could use a <Location /> section
    before the VirtualHosts sections and put your command in that and whatever
    you do would be globally applied to all sites.

    Side perk on either method placing commands in Apache's config file is that you
    don't have to worry about OpenBaseDir anymore because commands put into
    the Apache configuration itself are not subject to any of that.


    .
    Last edited by Spiral; 11-14-2006 at 10:30 AM.

Similar Threads & Tags
Similar threads

  1. Replies: 5
    Last Post: 02-14-2011, 04:12 AM
  2. CSf Firewall: Edit csf.deny, the IP address deny file (Currently:1000 permanent IP b
    By crazyaboutlinux in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 12-09-2010, 06:23 AM
  3. Error while trying to delete/edit files
    By Bakie in forum cPanel and WHM Discussions
    Replies: 4
    Last Post: 08-01-2007, 04:34 PM
  4. Cannot delete/edit/move/rename files in cPanel
    By iHost.net.nz in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-05-2004, 06:14 PM
  5. how to edit or delete .htaccess?
    By calvinvannguyen in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 03-17-2004, 05:40 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube