cp /usr/bin/wget /usr/bin/mywget
chmod 751 /usr/bin/mywgetSaturday, April 12, 2008
How to make empty file?
echo –n >filename
OR
How directly run webstat through IE ( i.e domainname.com/webstat)
cd /home/username/public_html
ln -s ../tmp/webalizer webstat
cd ..
chmod 755 tmp
cd tmp
chmod 755 webalizer
Friday, April 11, 2008
How to disable telnet access on server
1. Login to your server through SSH as a root user.
2. open file
# vi /etc/xinetd.d/telnet
3. Look for the line: disable = no and replace with disable = yes
4. Now restart the inetd service:
#/etc/rc.d/init.d/xinetd restart
5. Turn off it through chkconfig as well because it can still start through that.
#/sbin/chkconfig telnet off
6. Scan your server to ensure port 23 is closed.
#nmap -sT -O localhost
Also run ps -aux | grep telnet and if you find anything other than “grep telnet” as result kill the process.
Difference between Linux and Windows
All flavors of Windows come from Microsoft. Linux come from different companies like LIndows , Lycoris, Red Hat, SuSe, Mandrake, Knopping, Slackware.
Linux is customizable but Windows is not. For example,NASlite is a version of Linux that runs off a single floppy disk and converts an old computer into a file server. This ultra small edition of Linux is capable of networking, file sharing and being a web server.
Linux is freely available for desktop or home use but Windows is expensive. For server use, Linux is cheap compared to Windows. Microsoft allows a single copy of Windows to be used on one computer. You can run Linux on any number of computers.
Linux has hign security. You have to log on to Linux with a userid and password. You can login as root or as normal user. The root has full previlage.
Linux has a reputation for fewer bugs than Windows.
Windows must boot from a primary partition. Linux can boot from either a primary partition or a logical partition inside an extended partition. Windows must boot from the first hard disk. Linux can boot from any hard disk in the computer.
Windows uses a hidden file for its swap file. Typically this file resides in the same partition as the OS (advanced users can opt to put the file in another partition). Linux uses a dedicated partition for its swap file.
Windows separates directories with a back slash while Linux uses a normal forward slash.
Windows file names are not case sensitive. Linux file names are. For example "abc" and "aBC" are different files in Linux, whereas in Windows it would refer to the same file.
Windows and Linux have different concepts for their file hierarchy. Windows uses a volume-based file hierarchy while Linux uses a unified scheme. Windows uses letters of the alphabet to represent different devices and different hard disk partitions. eg: c: , d: , e: etc.. while in linux " / " is the main directory.
Linux and windows support the concept of hidden files. In linux hidden files begin with " . ", eg: .filename
In Linux each user will have a home directory and all his files will be save under it while in windows the user saves his files anywhere in the drive. This makes difficult to have backup for his contents. In Linux its easy to have backup's.
What is Digg?
How to submit stories?
Submitting stories to digg is very easy. To submit stories you have to be a registered member of the digg, once you have registered and signed in, just click on the option submit story and then enter the URL of the story which you would like to submit. Then enter the title of the story with a short description and select the proper category for the story. You are only allowed to digg only original story and not any duplicate entry.
What can you do as a digg user?
Every digg user can digg (help promote), bury (help remove spam), and comment on stories. You can even digg and bury comments you like or dislike. Digg also allows you to track your friends’ activity throughout the site.
Thursday, April 10, 2008
/Var FULL
echo > /var/log/exim_mainlogecho > /var/log/exim_rejectlogecho > /var/log/maillogecho > /var/log/messagesecho > /var/log/messages.1echo > /var/log/messages.2echo > /var/log/messages.3echo > /var/log/messages.4echo > /var/log/lastlogecho > /var/log/maillogecho > /var/log/maillog.1echo > /var/log/maillog.2echo > /var/log/maillog.3echo> /var/log/secureecho> /var/log/secure.1echo> /var/log/secure.2echo> /var/log/secure.3echo> /var/log/secure.4echo > /usr/local/apache/logs/access_logecho > /usr/local/apache/logs/suexec_logecho > /usr/local/apache/logs/error_logecho > /usr/local/cpanel/logs/access_logecho > /usr/local/cpanel/logs/error_logecho > /var/log/exim_mainlog.1echo > /usr/local/cpanel/3rdparty/mailman/logs/locksecho > /var/log/cron.2echo > /var/log/chkservd.logecho > /var/log/cron.4echo > /var/log/exim_paniclog.1echo > /var/log/exim_rejectlog.1echo > /var/log/exim_paniclog
Tuesday, April 8, 2008
Open DNS Servers
vi /etc/named.conf
Before the line that says “directory /var/named”; (it could be /var, /var/named, etc)
Put:
recursion no;
service named restart
Make sure you can ping yahoo.com and google.com afterwards.
Lame Server Resolve
service named stop
vi /etc/named.conf
add the three lines at the top
logging {
category lame-servers { null; };
};
service named restart
Using RPM
Installing software (rpm -i)
rpm -ivh package.rpm
Uninstalling software (rpm -e)
rpm -e software name
Updating packages (rpm -U)
Note :: This will uninstall and install the new package avoiding this annoying messages. It is also usual to install packages with –U flag in this way:
rpm -Uvh software.rpm
Lost Mysql root password ?
Few Simple steps to change your mysql root password.
service mysql stop
wait until MySQL shuts down. Then run
mysqld_safe –skip-grant-tables &
then you will be able to login as root with no password.
mysql -uroot mysql
In MySQL command line prompt issue the following command:
UPDATE user SET password=PASSWORD(”abcd”) WHERE user=”root”;
FLUSH PRIVILEGES;
At this time your root password is reset to “abcd” and MySQL will now
know the privileges and you’ll be able to login with your new password:
mysql -uroot -pabcd mysql
How to enable/disable PING
To Enable PING on the server
echo “0″ >> /proc/sys/net/ipv4/icmp_echo_ignore_all
To Disable PING on the server
echo “1″ >> /proc/sys/net/ipv4/icmp_echo_ignore_all
Missing DNS zone ?
If you are facing issue related to missing DNS zone with cpanel update do the following:
/scripts/perlinstaller Compress::Raw::Zlib
/scripts/perlinstaller –force Scalar::Util
This should fix the issue.
How to Set wildcard DNS
Edit the httpd.conf and add the line in virtual host of domain.
ServerAlias *.domain.com www.*.domain.com
restart httpd/apache service.
Now edit the DNS file or db file of domain and add the line as
*.domain.com. 14400 IN A IP of server
www.*.domain.com. 14400 IN A IP of server
restart named service
To turn off register globals for a particular user
php_flag register_globals off
How To use Yum
- To seach for a application
Yum will search all your enabled repos and tell you where you can obtain the package from
yum search application_name
- Yum can list all available packages from your enabled repos and tell you where you can obtain the package from:
yum list available
- To find out more info about some package
yum info application_name
- Installing applications
Inastalling is as easy as
yum install application_name
- Listing rpms
yum can list installed rpms for you from the repos you have enabled
yum list extras
- Removing rpms
Yum can remove a application and the dependenciesit installed with tat application. it will not remove depenencies if another application installed needs them.
yum remove application_name
- Updating the system
Yum can update the system for you with out user interact if you want it to.
yum update
- Not sure if you have upates?
yum check-update
- Local install
downloaded a rpm and cannot install it with rpm because of dependencies?
yum localinstall /path/to/the/rpm
Saturday, April 5, 2008
How to increase file limit
ulimit -n
cat /proc/sys/fs/file-nr
The default limit is 1024.
Get current number of open file descriptors:
lsof [-p pid] | wc -l
Increase the limit:
Edit /etc/security/limits.conf
:
username hard nofile 32768
Send Email from a PHP Script Using SMTP Authentication
Adapt the example below for your needs. Make sure you change the following variables at least:
* from: the email address from which you want the message to be sent.
* to: the recipient's email address and name.
* host: your outgoing SMTP server name.
* username: the SMTP user name (typically the same as the user name used to retrieve mail).
* password: the password for SMTP authentication.
------------------------------------------------------------------------------------------------
require_once "Mail.php";
$from = "Bill Sender
$to = "Ninad Recipient
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "mail.example.com";
$username = "smtp_username";
$password = "smtp_password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("
" . $mail->getMessage() . "
");} else {
echo("
Message successfully sent!
");}
?>
-- Dhananjay Sonawane
Cron to delete mails from Inbox
Cron to delete mails from Inbox
Here is the syntax for deleting all email in the inbox of the default email address for a website:
echo -n > /home/youraccount/mail/inbox
-- Dhananjay Sonawane