List of Common Paths on a Cpanel Based Linux Server.

Here is a list of commonly used paths on a cpanel based Linux server. Some paths might be common in default Linux installations too:

The webroot path is /home/username/public_html

The path to your email is /home/username/mail/domain.tld/user's name/

The save session path is /home/username/tmp

The path to AWStats is /home/username/tmp/awstats

The path to cgi is /home/username/public_html/cgi-bin/ or /var/www/cgi-bin

The path to Perl is /usr/local/bin/perl

The local path to Sendmail is /usr/sbin/sendmail

The path to PHP is /usr/bin/php

The path to PHP 5.3 on shared & reseller servers is /opt/php53/bin/php

The path to Zend Optimizer is /usr/local/Zend

The path to MySQL is /var/lib/mysql

The path to Mysqldump is /usr/bin/mysqldump

The path to Pear is /usr/bin/pear

The path to Python is /usr/bin/python

The path to Python 2.7 is /usr/bin/python2.7

The path to openSSL is /usr/bin/openssl

The FTP root path is /home/username/ (only accessible if using the cPanel login)

The FTP directory path is /public_html/ or just leave blank

The path to Aspell is /usr/bin/aspell

The local path to ImageMagick is /usr/bin/

The local path to convert with ImageMagick is one of the following...
  • /usr/bin/convert
  • /usr/local/bin/convert
  • /usr/bin/X11/convert
The path to the GD2 library is /usr/lib

The path to the GD2 include directory is /usr/include

The path to rsync is /usr/bin/rsync

Path to ghostscript is /usr/bin/ghostscript

Path to Exim logs is /var/log/exim_mainlog

Path to Alias files is /etc/valiases/

The path to PHPmyadmin is http://yourdomain.com:2082/3rdparty/phpMyAdmin/index.php

The path for sbin is /usr/sbin - but is not accessable.

The path for cgi-sys is /var/cpanel/cgi-sys

The path to Apache on a Linux server is /usr/local/apache

The path to Get is /usr/bin/GET

The path to LYNX is /usr/bin/lynx

The path to WGET is /usr/bin/wget

The path to CURL is /usr/bin/curl

The path to FFMPEG is /usr/bin/ffmpeg 

Block an IP Address on a Linux server running iptables.

To block an IP on your Linux server you need to use iptables tools  and netfilter firewall. 

First you need to log into shell as root user. 


To block an IP address you need to type the iptables command as follows: 


# iptables -A INPUT -s IP_address -j DROP 


Replace IP_address with your actual IP address which you want to block. 

For example, if you wish to block an ip address 192.168.10.25 for whatever reason then type the command as follows: 

# iptables -A INPUT -s 192.168.10.25 -j DROP 


If you have IP tables firewall script, add the above rule to your script.If you just want to block access to one port from an ip 192.168.10.25 to port 22 then type command: 

# iptables -A INPUT -s 192.168.10.25 -p tcp --destination-port 22 -j DROP 


For CentOS / RHEL / Fedora operating systems, in-order to block An IP And Save It To Config File Type the following commands: 


# iptables -A INPUT -s 192.168.10.25 -j DROP # service iptables save




How to Restore deleted Active Directory Objects for an User.

You have deleted some objects for an user in Active Directory ?

There is no need to worry regarding it as there is a trick to restore the active directory object. Please note that it only works if:

  • The forest functional level is 2008 R2 (only if all domain controllers are running Windows 2008 R2)
  • The Active Directory Recycle Bin was enabled before the object was deleted.

If both the above conditions are satisfied then you can restore the Active Directory Object using the following command:

Get-ADObject -Filter {samaccountname -like '*linwin*'} -IncludeDeletedObjects -Server domaincontroller_name | Restore-ADObject -PassThru

How to find user in active directory with missing or empty attribute


You can use the normal "Get-ADUser" cmdlet for figuring out the users with missing or empty attribute:


Get-ADUser -Filter {-not (employeeid -like "*") }

The above command will return all objects that have the property empty.

using $null to match the filter criteria will result in the following error:
====================================================================
Get-ADUser : The search filter cannot be recognized
====================================================================

Google chrome updates are disabled by the administrator

Issue Symptoms:

Google Chrome Displays the following error when clicked on "About Google Chrome"
=========================================
Google chrome updates are disabled by the administrator
=========================================

Resolution Steps:

If your google updates are disabled by the administrator so you can’t update, Don’t worry anymore here is the solution! It’s very easy and it only takes 5 minutes to fix this issues.

  1. Go to Windows Start Button on the left bottom and Click on Run.
  2. Type in regedit on the run.
  3. Go to HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Google\Update
  4. Double Click on the UpdateDefault
  5. Change the value from 0 to 1.
  6. Restart your Chrome Browser and try to update again.

How to enable SPF and domain keys via Cpanel.



Install SPF :

------------------
In-order to enable SPF via cpanel on a domain you can use either of the following steps:
1. Login to Cpanel >> Mail >> Mail authentication >> Enable spf
or
2. Login to Cpanel >> Main >> DNS Functions >> Edit DNS Zone
and add the following entry:
=========================================================================
domain.com.  IN TXT “v=spf1 a ~all” or v=spf1 a mx ip4:94.76.206.142 ?all
=========================================================================


Install  Domainkey :

---------------------------
In-order to install Domainkey on a domain you can use either of the following steps:
1. Login to cpanel >> Mail >> Mail Authentication >> Enable domainkeys
or
2, You can use the following script on the cpanel based server via command line and activate it:
=========================================================================
/usr/local/cpanel/bin/domain_keys_installer username
=========================================================================

WHM Displaying Unlimited Quota (edquota: Quota file not found or has wrong format. No filesystems with quota detected.)

Issue Faced Symptoms:

While running /scripts/fixquotas it displays the following error message and also displays unlimited disk space in 
WHM >> Main >> List accounts.

============================================================
root@server [/]# /scripts/fixquotas --force
Installing Default Quota Databases......Done
Linux Quota Support
Quotas are now on
Reading package package1
Resetting quota for user1 to 10000 M
edquota: Quota file not found or has wrong format.
No filesystems with quota detected.
Reading package package2
Resetting quota for user2 to 300 M
edquota: Quota file not found or has wrong format.
No filesystems with quota detected.
Reading package package3
Resetting quota for user3 to 2000 M
edquota: Quota file not found or has wrong format.
No filesystems with quota detected.
============================================================

Resolution Steps:

============================================================
root@server [/]#touch /home/quota.user
root@server [/]#touch /home/quota.group
root@server [/]#chmod 600 /home/quota.user
root@server [/]#chmod 600 /home/quota.group
============================================================

Sometimes the following command too gives error message:
============================================================
root@server [/]# quotacheck -acugv
quotacheck: Cannot remount filesystem mounted on / read-only so counted values might not be right.
Please stop all programs writing to filesystem or use -m flag to force checking.
============================================================

Then run following command
============================================================
root@server [/]# quotacheck -acugvm
quotacheck: Scanning /dev/simfs [/] quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
quotacheck: Cannot stat old user quota file: No such file or directory
quotacheck: Cannot stat old group quota file: No such file or directory
done
quotacheck: Checked 35178 directories and 378713 files
quotacheck: Old file not found.
quotacheck: Old file not found.
============================================================

Then run the following command to fix the issue:
============================================================
root@server [/]#/scripts/fixquotas --force
============================================================

Get current Logon Server.



Sometimes when logged into any windows machines/Servers you wonder about the exact logon server which you used to login. So, in-orderto gather the exact Logon Server Name you can use the following command in your powershell and it will display the exact logon Server Name:



[System.Environment]::GetEnvironmentVariable("logonserver")

Active Directory schema attribute details



The Active Directory schema contains formal definitions of every attribute that can exist in an Active Directory object. 

$schema =[DirectoryServices.ActiveDirectory.ActiveDirectorySchema]::GetCurrentSchema()

$schema.FindClass('user').optionalproperties | Where-Object {$_.name -eq 'employeeid'}