Control mounting a file system

You can have more control on mounting a file system like /home and /tmp partitions with some nifty options like noexec, nodev, and nosuid. This can be setup in the /etc/fstab text file. The fstab file contains descriptive information about the various file systems mount options; each line addresses one file system.

Details regarding to security options in the fstab text are:

defaults: Allow everything quota, read-write, and suid on this partition.
noquota: Do not set users quotas on this partition.
nosuid: Do not set SUID/SGID access on this partition.
nodev: Do not set character or special devices access on this partition.
noexec: Do not set execution of any binaries on this partition.
quota: Allow users quotas on this partition.
ro: Allow read-only on this partition.
rw: Allow read-write on this partition.
suid: Allow SUID/SGID access on this partition.

More information can be found in the mount(8) man pages

How to change apache to do graceful restarts in DirectAdmin

To do that, you’ll need to change your httpd boot script.
The path for your script will vary depending on your OS.

For FreeBsd it’s:
/usr/local/etc/rc.d/httpd

For all other OS’s, it’s:
/etc/init.d/httpd

As for the actual change, you’ll edit the httpd boot script for your system, find this code:

restart)
stop
waitforexit “httpd” 20
start
;;

and change it to read:

restart)
kill -USR1 `cat $PIDFILE`
;;

An apache restart will no longer start apache if it’s stopped. You must “start” it, as the graceful restart only works on already running processes.

Source : http://directadmin.com

Rebuild Apache with Higher FD_SETSIZE

The default FD_SETSIZE for apache is 1024. This is a hardcoded value which sets the maximum amount of files that apache can open at any given time, including log files, CGI scripts, PHP includes, database connections, etc. It is hardcoded to prevent apache from using an insane amount of file descriptors and starving your system of resources. However, if you have a lot of domains on your server with their own transfer and error logs (500+ on standard RedHat, 250-300 on Plesk servers) then you may hit the 1024 limit and get all sorts of weirdness.

At worst apache will fail to start or will not serve any web pages if it does start.

What needs to be done is to install the apache source RPM, modify the sources and spec file, and rebuild the source RPM and binary RPMs with the modified FD_SETSIZE (4096 in this case).

For DirectAdmin

Edit /usr/include/bits/typesizes.h and /usr/include/linux/posix_types.h and set

#define __FD_SETSIZE 32768

And then recompile with customapache or custombuild.

Setting up the Linux terminal to use proxy servers

If you are running proxy at IP 192.168.1.1 with the proxy port as 3128 and wish to use wget, lynx and other utilities from a shell prompt then export the following variables on the command line.

export http_proxy=http://192.168.1.1:3128/
export ftp_proxy=http://192.168.1.1:3128/
export ftps_proxy=http://192.168.1.1:3128/
export https_proxy=http://192.168.1.1:3128/

Now your will be able to use the update commands from the command line.

Using perl to make custom changes to files

The below example shows how to make changes to the virtual host conf files. Here we are changing CustomeLog to #CustomLog.

perl -pi -e ’s/CustomLog/#CustomLog/’ virtual_host*.conf

« Prev - Next »