How to use the chattr command ?
This is an admin command. Only the Root user can change the file attributes/Process. chattr command is used to change the file attributes.
Syntax:
chattr [options] filename
+i - Make the file as Read-Only.
-i - Remove the Read-Only.
+a - Can't open file for writing
-a - Open file for writing.
+S - The changes in the file are written synchronously on the disk.
Example:
chattr +i file.txt
chattr -i file.txt
/etc/hosts entry
The entries in the /etc/hosts file
You can use below mentioned steps to make changes in the file.
Example :
- If you are using a Windows machine
Add entry in this file : %SystemRoot%\system32\drivers\etc\ (where %SystemRoot% is C:\Windows in a Normal case, change it accordingly)
- If you are using a Linux machine, Add entry here in this file : /etc/hosts
- If you are using a Mac, Add entry here in this file : /private/etc/hosts
<IP> domain.com www.domain.com |
Example :
192.234.45.12 example.com www.example.com
cPanel Log Files
The list of Log files
This will help you for trouble shooting the problems
Instructions
Access log & cpsrvd user activity /usr/local/cpanel/logs/access_ log
Account transfers & related activity /var/cpanel/logs
Account activity audit log /var/cpanel/accounting.log
Account bandwidth history /var/cpanel/bandwidth
/var/cpanel/bandwidth.cache
Brute force protection (cphulkd) /usr/local/cpanel/logs/ cphulkd.log
Backup Logs /usr/local/cpanel/logs/ cpbackup
Maldet scan
How to run a Maldet scan in the server
maldet -a -b ~user
tail /usr/local/maldetect/event_log
How to Fix the hits
cd /usr/local/maldetect
&&
rm -rf sigs/ && mkdir sigs/ && maldet -u
Permissions for webhosting accounts
public_html - 750
Folders - 755
CGI and Perl scripts - 755
.html .php and other Document Types - 644
Top command
top command displays the top cpu processes in the server
N-sort tasks by pid (numerically).
A-sort tasks by age (newest first).
P-sort tasks by CPU usage (default).
M-sort tasks by resident memory usage.
T-sort tasks by time / cumulative time.
1-display CPUs seperatly
Command to check DDoS attacks
How to check is there any DDoS attacks to your server?
use the command
netstat -plan|grep :80 |awk '{print $5}' |cut -d: -f1 |sort |uniq -c |sort -n
This will check number of ip connections to the server.
Create a PHP info page
How to Create a PHP info page ?
Create phpinfo.php file under the document root
#vi phpinfo.php
<?
phpinfo();
?>
You can test it by checking the url
domainame/phpifo.php
Subscribe to:
Posts (Atom)