1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to lock html files?

Discussion in 'Security' started by Dzonny, May 11, 2012.

  1. #1
    Hello there.

    Let's say that i would like to somehow lock specific file, like index.html from my VPS root, and i don't want it to be changed for good via ftp. Can i somehow "lock" it, so everyone can see it (load it via browsers) and see it in ftp clients (those with access) but can't change it? Maybe there's some permission that i should change?

    I'm running CentOS VPS for what it's worth.
    SEMrush
    Thanks,
    Dzonny
     
    Solved! View solution.
    Dzonny, May 11, 2012 IP
    SEMrush
  2. #2
    You may want to look into the 'chattr' commands. You would run, for instance, chattr +i index.html which would set the file to be immutable. When you would want to change it, you would run chattr -i index.html and proceed with your updates. Hope that helps!
     
    fixyourserver, May 12, 2012 IP
  3. MarkElse101

    MarkElse101 Peon

    Messages:
    15
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    you could change the group owner of the file (by default it would be user:user - user=account owner), if you logged in via root you could assign it to a higher user group (for e.g. (although not recommended) root:root using ssh and the chown command, by setting it to a higher user you would need to be on the same clearance level to overwrite the file, should also prevent it from being edited
     
    MarkElse101, May 17, 2012 IP
  4. fixyourserver

    fixyourserver Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    1
    Trophy Points:
    0
    #4
    In most cases if you change the permissions on a file using chmod, then Apache will not have the rights to read the file. If you change the owner using chown and you're utilizing suexec or similar this can cause issues with the execution of files, for instance, cgi and php scripts. The chattr command makes the file unable to be altered until the user or a higher level user removes the immutable bit put in place using the chattr command.
     
    fixyourserver, May 20, 2012 IP