Fixin’ issues one ticket at a time!
Chattr FTW!
I’m tired of clients breaking their sites and then complaining about it saying it’s an issue with the server, when in reality it’s 100% their fault to begin with. I’ve ran into a few issues where clients needed something set in their php.ini or .htaccess in order for their site to work, such as “allow_url_fopen” or “register_globals”. So to make things easier on the client I would set these variables for them and get their site working. Normally I would not hear back from the client if they left things alone, but it seems like lately the inexperienced clients have been getting the urge to modify the changes I’ve made, thus breaking their site an either getting either a 500 or some other kind of error. To prevent something like this from happening, you can go in an change the file attributes to keep them from screwing things up by using chattr. Chattr is also useful for important files on the server, as it can prevent people from removing those critical files from the server.
The letters select the new attributes for the files: append only (a), compressed (c), no dump (d), immutable (i), data journalling (j), secure deletion (s), no tail-merging (t), undeletable (u), no atime updates (A), synchronous directory updates (D), synchronous updates (S), and top of directory hierarchy (T).
Using chattr is pretty straight forward as the syntax is not too complicated. The command below would add the A and I attributes to the file, thus making it read-only so that it cannot be deleted nor modified
chattr +ai /home/clay/public_html/.htaccess
To remove the file attributes you would simply replace the “+” with “-” like so.
chattr -ai /home/clay/public_html/.htaccess
There are other attributes that can used with chattr but “AI” are the ones I commonly use. Now you can have fun using chattr to prevent clients from changing files they shouldn’t be changing.
| Print article | This entry was posted by Clayton on October 13, 2009 at 10:17 pm, and is filed under Linux, SSH, Tutorial. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
No comments yet.
No trackbacks yet.
Installing RKHunter
about 7 months ago - No comments
Be honest, how much have you considered server security in the past? In this day and age, it’s not something that should be taken lightly. Today I’ll be teaching you how to install RKHunter. RKHunter (ie: Rootkit Hunter) is a nifty little script that runs via cron daily that checks your server for the most
Session.save_path error
about 8 months ago - No comments
So…I came across this error on a clients site which he was receiving when trying to install a 3rd party script. The session.save_path setting in your php configuration file (php.ini) is not set or is set to a folder which did not exist. You might need to set the save_path setting in php.ini or verify
Install fantastico on cPanel
about 8 months ago - 7 comments
A fantastico installation is pretty straight forward. First thing you need to do is obtain a Fantastico license from Netenburg. One of the most common issues when installing fantastico is a buggy wget install on the server, so a working wget version will need to be installed. Another common issue is cPanels internal php may
Exim Error: Ratelimit database not available
about 8 months ago - 8 comments
2009-07-20 21:58:07 Failed to get write lock for /var/spool/exim/db/ratelimit.lockfile: timed out 2008-07-20 21:58:07 H=[xx.xx.xx.xx] temporarily rejected connection in “connect” ACL: ratelimit database not available To fix such an error , the exim cache database on the server side needs to be clear off to stop this message. Run the folllowing command on root : root@lolwut
Creating an extracting tar files
about 8 months ago - 3 comments
The most common compressed archive file format in Linux is the tar.gz format. Tar file is an archive file format. Tar.gz is a compressed tar file. How to create a compressed tar.gz file from a folder or file in Linux? In order to create a compressed tar.gz archive from a folder/file we need to run
pty, ptyp, and tty errors
about 9 months ago - No comments
So I came across this error for the first time today when trying to SSH directly into a clients VPS. login as: root root@server’s password: Server refused to allocate pty stdin: is not a tty After a quick google search I came across the fix. [root@node /]# vzlist -a VEID NPROC STATUS IP_ADDR HOSTNAME 1337
Install Perl
about 9 months ago - No comments
Very simple install, only 4 commands via SSH and takes about 20 minutes for the install to complete. wget http://layer1.cpanel.net/perl588installer.tar.gz tar -xvzf perl588installer.tar.gz cd perl588installer ./install //
Upgrade MySQL4 to MySQL5 on cPanel server
about 9 months ago - 3 comments
Upgrading MySQL versions is a quick and easy process, not much work involved. Always be sure to make a backup before you start though, just in case the upgrade fails or some other unforeseen issue arises. cp -Rpf /var/lib/mysql /var/lib/mysql.BAK Login to WHM –> Tweak Settings –> MySQL -> 5.0 and Save settings /scripts/mysqlup –force
Disable root SSH access
about 9 months ago - 3 comments
Allowing the root user to login directly is a major security issue, we’ll show you how to disable it so you can still login as root but just not directly, reducing the security issue. This will force a hacker to have to guess 2 seperate passwords to gain root access. (you do have 2 seperate
Screen in SSH
about 9 months ago - 1 comment
I’m short on time, but here’s a nice little tutorial on screen in SSH courtesy of Aperiodic.net. Getting in start a new screen session: screen .. with session name: screen -S <name> attach to a running session: screen -r .. to session with name: screen -r <name> the “ultimate attach”: screen -dRR (Attaches to a