CSF Directadmin Issue Permission denied [User:admin UID:501]- Solved


This is a simple permission issue in directadmin. The CSF in directadmin is running a setuid program. So it simply need to enable the  setuid  permission for the root user in this  program.   You may need to look into the following  file ,

# ls -al /usr/local/directadmin/plugins/csf/exec/csf
-rwxr-xr-x 1 root root 8112 Jun 23 10:37 /usr/local/directadmin/plugins/csf/exec/csf

Now you need to enable the “S” bit as follows,

#  chmod  4755  /usr/local/directadmin/plugins/csf/exec/csf
# ll /usr/local/directadmin/plugins/csf/exec/csf 
-rwsr-xr-x 1 root root 8112 Jun 23 10:37 /usr/local/directadmin/plugins/csf/exec/csf

Now login to the directadmin  as admin user and check the CSF page. It must work.

How to convert directadmin to SUPHP the easy method version 2

Conversion to SUPHP in directadmin is easy. You may please proceed with the following steps

1) Set the following custom build options

/build set php5_cgi yes
./build set php5_cli no

2)Now compile apache and php using the following commands

./build all d
./build rewrite_confs

3) Now need to fix the roundcube , squirrelmail and phpmyadmin permissions as follows,

./build roundcube
./build squirrelmail
./build phpmyadmin

4) Now need to fix the ownership and permission of files and dirs as follows,

# for i in `/bin/ls /usr/local/directadmin/data/users/` ; do chown -R $i.$i /home/$i/domains/* ; echo $i ;done 
# for i in `/bin/ls /usr/local/directadmin/data/users/` ; do find /home/$i/domains/ -type f -exec chmod 644 {} \; ; echo $i ;done
# for i in `/bin/ls /usr/local/directadmin/data/users/` ; do find /home/$i/domains/ -type d -exec chmod 755 {} \; ; echo $i ;done

This easy steps will help you to conversion your directadmin to suphp and fix the permission issues in your scripts.

How to do Directadmin to Directadmin Migration

The directadmin to directadmin migration is easy.

  • Set the value  skip_domains_in_backups=1  in  /usr/local/directadmin/conf/directadmin.conf . This will skip coping home folder during backup creation.
  • Do to admin panel Admin Tools -> Admin Backup/Transfer , And select all users and run a backup now .This will take all accounts backups under the folder  /home/admin/admin_backups.
  • Now login to the admin panel of the new server and  go to Admin Tools -> Admin Backup/Transfer , then select the  “restore backups “. Chose all the backups files and  click the  submit.
  • Monitor the new server and wait for finishing  the restore. You can check the top comand and  or use pstree. See if the comamnd  dataskq completed or not. Also check the home folders .
  • After finishing it simply rsync the home folders.

How to install eAccelerator in directadmin server

The eaccelerator installation in directadmin is easy . This procedure is same in all php linux distribution. You may need to do the following procedure. This is based on redhat / centos distributions

1) Download the latest eaccelerator source files from  http://sourceforge.net/projects/eaccelerator/   and extract it  after that run the following commands

# yum -y install autoconf
# phpize
# ./configure
# make
# make install

2) Find the php.ini using the command ” php –ini” and edit it .  The update the  “extension_dir ” current extension  directory . This path contains all the  php  third party installations.

# php --ini | grep Configuration
Configuration File (php.ini) Path: /usr/local/etc/php5/cgi
Loaded Configuration File:         /usr/local/etc/php5/cgi/php.ini
# grep extension_dir /usr/local/etc/php5/cgi/php.ini
extension_dir = "/usr/local/lib/php/extensions/no-debug-non-zts-20090626"

Please note the extension_dir path will be different in your server.

3) Now add the following lines at the end of php.ini


4) Now create the cache folder  /var/cache/eaccelerator

# mkdir /var/cache/eaccelerator
# chmod  777 /var/cache/eaccelerator

5) Restart apache  and test it

How to install DBD::mysql in directadmin

To install DBI and DBD:mysql from source, run the following:

wget http://www.cpan.org/modules/by-module/DBD/DBI-1.608.tar.gz
tar xvzf DBI-1.608.tar.gz
cd DBI-1.608
unset LANG;
perl Makefile.PL
make install

cd ..
wget http://www.cpan.org/modules/by-module/DBD/DBD-mysql-3.0002.tar.gz
tar xvzf DBD-mysql-3.0002.tar.gz
cd DBD-mysql-3.0002
unset LANG;
perl Makefile.PL
make install

You can also install it using the cpan mirrors as follows,

perl -MCPAN -e 'install Bundle::DBD::mysql'

How to install suphp in directadmin

Directadmin came with php ad CLI options. So the php scripts run as apache user.  You can use suphp , which help the php run as local user.  Dircetadmin  support suphp without much issues.  Please  use the following steps to  enable suphp in directadmin.

cd /usr/local/directadmin/custombuild/
./build clean
./build update
./build set php5_cgi yes
./build set php5_cli no
./build all d
./build rewrite_confs

Now you  installed suphp in the server

You may need to rewrite the webapps php scripts to reset the ownerships if you get internal server errors with them, eg:

./build roundcube
./build squirrelmail
./build phpmyadmin

Please make sure  to change all 777 folders to 755  permission and change all 777 php scripts to 644 permission , otherwise you will get 500 internal server error  in your wesbites.

How to rest mysql root password in directadmin

When connecting to the MySQL screens in DirectAdmin, if this error appears, that would indicated that the “da_admin” user has not been setup correctly.  Also you are reset the mysql root password too. To resolve this do the following.

/etc/init.d/mysqld stop
mysqld_safe --skip-grant-tables &

That should start up mysql without the need for a root password.  Once in, type

use mysql;
update user set Password=PASSWORD('newpass') where user='root';

Now we need to make sure it’s setup correctly for DA to use.   Edit /usr/local/directadmin/conf/mysql.conf and set


Now edit the file /root/.my.cnf  and add the following lines