<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Submit Suite Blog &#187; linux</title>
	<atom:link href="http://www.submitsuite.com/blog/tag/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://www.submitsuite.com/blog</link>
	<description>Submit Suite blog with SEO products and services</description>
	<lastBuildDate>Tue, 24 Nov 2009 10:08:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Webmaster manual for a root server</title>
		<link>http://www.submitsuite.com/blog/webmaster-manual-for-a-root-server-283</link>
		<comments>http://www.submitsuite.com/blog/webmaster-manual-for-a-root-server-283#comments</comments>
		<pubDate>Mon, 16 Nov 2009 14:09:54 +0000</pubDate>
		<dc:creator>Marius Mailat</dc:creator>
				<category><![CDATA[SEO news]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[manual]]></category>
		<category><![CDATA[root server]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.submitsuite.com/blog/?p=283</guid>
		<description><![CDATA[I receive quite often questions about server and server problems. Most of the webmasters have a root server or at least a vhosting and usually these servers comes with administration &#8220;duties&#8221;. Here is bellow my list with commands I am using for my servers: What I do in case nothing is working and I want [...]<p>Article published in <a href="http://www.submitsuite.com/blog">Submit Suite Blog</a>.
<br/><br/><a href="http://www.submitsuite.com/blog/webmaster-manual-for-a-root-server-283">Webmaster manual for a root server</a></p>
]]></description>
			<content:encoded><![CDATA[<p>I receive quite often questions about server and server problems. Most of the webmasters have a root server or at least a vhosting and usually these servers comes with administration &#8220;duties&#8221;. Here is bellow my list with commands I am using for my servers:<img title="More..." src="http://www.submitsuite.ro/blog/wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" /><span id="more-283"></span></p>
<h3>What I do in case nothing is working and I want to repair my system?</h3>
<p>/etc/init.d/psa stopall<br />
umount -a<br />
xfs_check /dev/md1<br />
xfs_repair /dev/md1<br />
xfs_check /dev/md5<br />
xfs_repair /dev/md5<br />
xfs_check /dev/md6<br />
xfs_repair /dev/md6<br />
xfs_check /dev/md7<br />
xfs_repair /dev/md7<br />
xfs_check /dev/md8<br />
xfs_repair /dev/md8<br />
mount /dev/md1 /mnt<br />
mount /dev/md6 /mnt/var<br />
mount /dev/md5 /mnt/usr<br />
mount /dev/md7 /mnt/home<br />
mount /dev/md8 /mnt/srv<br />
chroot /mnt<br />
/etc/init.d/psa start</p>
<p>Obviously, the above commands must match the existing partitioning on your root server.</p>
<h3>How to see the last commands in the system for the current user (or any user)?</h3>
<p>less ~/.bash_history</p>
<p>or</p>
<p>history</p>
<p>Note: These two will work ONLY is history hasn&#8217;t be set to 0 (like for instance issuing a &gt;.bash_history or export HISTSIZE=0</p>
<h3>How can I allow ftp upload resume?</h3>
<p>vi /etc/proftpd.conf<br />
/etc/init.d/xinetd restart</p>
<h3>Who is using the memory?</h3>
<p>top</p>
<h3>Where to tune Apache?</h3>
<p>/etc/apache/httpd.conf<br />
/etc/apache/server-tunning.conf</p>
<h3>Where are Apache logs?</h3>
<p>/var/log/apache2</p>
<h3>How can I show IPs in case of the bot attack?</h3>
<p>netstat -nt</p>
<h3>Show unique ips TCP</h3>
<p>netstat -anp |grep &#8216;tcp&#8217; | awk &#8216;{print $5}&#8217; | cut -d: -f1 | sort | uniq -c | sort -n</p>
<h3>Show unique ips UDP</h3>
<p>netstat -anp |grep &#8216;udp&#8217; | awk &#8216;{print $5}&#8217; | cut -d: -f1 | sort | uniq -c | sort -n</p>
<h3>How can I ban an IP in IP tables?</h3>
<p>iptables -I INPUT -s 217.218.36.11 -j DROP</p>
<h3>How can I backup the MySql database?</h3>
<p>mysqldump &#8211;user=admin &#8211;password=SSSS &#8211;create-options database_name &gt; /tmp/database_name.sql<br />
or<br />
mysqldump -user=admin &#8211;password= SSSS &#8211;all-databases -p &#8211;create-options | bzip2 -c &gt; databasebackup.sql.bz2<br />
or<br />
mysqldump -uadmin -pSSSS &#8211;all-databases &#8211;create-options | bzip2 -c &gt; databasebackup2.sql.bz2</p>
<p>Note: It is strongly recommended to stop MySQL prior to launch the commands above.</p>
<h3>How can I import the MySql database?</h3>
<p>mysql -uadmin -pSSSS database_name &lt; /tmp/database_name.sql</p>
<p>Note: If the &#8211;create-options parameter has been given when the databases were dumped, databases will be automatically imported when importing</p>
<h3>How can I rebuild the Webalizer stats?</h3>
<p>rm -f /usr/local/psa/var/lib/webalizer/webalizer.cache<br />
touch /usr/local/psa/var/lib/webalizer/webalizer.cache<br />
chown root:root /usr/local/psa/var/lib/webalizer/webalizer.cache<br />
chmod 644 /usr/local/psa/var/lib/webalizer/webalizer.cache<br />
stat -f /usr/local/psa/var/lib/webalizer/webalizer.cache<br />
cd /usr/local/psa/admin/sbin/<br />
/usr/local/psa/admin/sbin/statistics</p>
<h3>How can I restart the MySql?</h3>
<p>/etc/init.d/mysql restart</p>
<h3>How can I do remote backup?</h3>
<p>/usr/local/psa/bin/pleskbackup all ftp://username:password@backup.onlinehome-server.info/httpdocs/backup.file</p>
<h3>What about a complete big backup?</h3>
<p>/usr/local/psa/bin/pleskbackup all allbackup.file<br />
tar czf /srv/www/vhosts backup</p>
<h3>How to tar a folder (with all sub-folders and files)?</h3>
<p>tar czf /volumes/myexternaldrive/backup01.tgz myfolder</p>
<h3>How do I extract a file?</h3>
<p>tar -xzvf MyArchive.tgz Source_file<br />
or<br />
tar &#8211;extract &#8211;gunzip &#8211;verbose &#8211;file=MyArchive.tgz Source_file<br />
tar xzvf /volumes/myexternaldrive/backup01.tgz myfolder/subfolder/thefiletorestore</p>
<h3>How to install SOAP extension for php 5?</h3>
<p>rpm -Uvh ftp://fr2.rpmfind.net/linux/SuSE-Linux/i386/update/10.2/rpm/x86_64/php5-soap-5.2.0-12.x86_64.rpm</p>
<h3>How to launch an sql against the database?</h3>
<p>mysql -uadmin -pparola baza_date &lt; /srv/www/vhosts/domeniu.com/httpdocs/clean.sql</p>
<h3>What version of Linux I am using?</h3>
<p>cat /proc/version<br />
cat /etc/issue</p>
<p>or version specifc:</p>
<p>cat /etc/redhat-release<br />
cat /etc/debian_version</p>
<h3>Root viruses check &#8211; Rhunter</h3>
<p>wget http://superb-east.dl.sourceforge.net/sourceforge/rkhunter/rkhunter-1.3.4.tar.gz<br />
tar -xzvf rkhunter-1.3.4.tar.gz<br />
cd rkhunter-1.3.0.tar.gz<br />
./installer.sh &#8211;layout /usr/local &#8211;install</p>
<p>add RHunter in cronjob<br />
vi /etc/cron.daily/rkhunter.sh<br />
and add<br />
#!/bin/bash<br />
/usr/local/bin/rkhunter -c | mail -s &#8220;RKhunter Scan Details&#8221; email@domain.com<br />
exit 0</p>
<h3>Root viruses check &#8211; chkrootkit</h3>
<p>wget &#8211;passive-ftp ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz<br />
tar xvfz chkrootkit.tar.gz<br />
cd chkrootkit-/<br />
./chkrootkit</p>
<p>netstat -an |grep &#8220;[.:]${465}[^0-9.]&#8221;<br />
netstat -e -p<br />
netstat -a |grep 4000</p>
<p>netstat -e -p -n -a | grep 465<br />
ps ax | grep 3456</p>
<h3>How to change the SSH port?</h3>
<p>vi /etc/ssh/sshd_config (change to the port 8993)<br />
/etc/rc.d/sshd restart</p>
<h3>How to limit the wrong longins (3 mins SSHD)?</h3>
<p>iptables -A INPUT -m tcp -p tcp &#8211;dport 8993 -m state &#8211;state ESTABLISHED,RELATED -j ACCEPT<br />
iptables -A INPUT -m tcp -p tcp &#8211;dport 8993 -m state &#8211;state NEW -m limit &#8211;limit 2/min &#8211;limit-burst 2 -j ACCEPT<br />
iptables -A INPUT -m tcp -p tcp &#8211;dport 8993 -j DROP</p>
<h3>How to list applications connected to Internet and the ports used?</h3>
<p>netstat -lptu</p>
<h3>How to search a file?</h3>
<p>find / -name pleskbackup</p>
<p>or faster if you&#8217;ve created an indexed database of files. First run updatedb (and have it scheduled to run from time to time, daily if there aren&#8217;t many files or weekly if there are many files) and once the database has been created (and updated) you can simply type: locate filename</p>
<p>For full paths of commands in your path you can use: which filename</p>
<h3>How to find the biggest files in the HDD?</h3>
<p>du -a /var | sort -n -r | head -n 10<br />
find . -type f -size +500000k -exec ls -lh {} \; | awk &#8216;{ print $9 &#8220;: &#8221; $5 }&#8217;<br />
rm -rf /fisier</p>
<h3>How to deactivate ZMD?</h3>
<p>/var/lib/zmd/zmd.db<br />
ps -axfu | grep parse-metadata<br />
kill -9 32323<br />
rm /var/lib/zmd/zmd.db<br />
/etc/init.d/novell-zmd start</p>
<h3>How to find the users with rights to log into the system?</h3>
<p>cat /etc/passwd |grep -v nologin | cut -d: -f1</p>
<h3>Who is logged in the system?</h3>
<p>w<br />
who -a<br />
users<br />
last (includes also users that have logged since the last time the database has been initialized)<br />
grep sshd /var/log/messages</p>
<h3>Bad cases, harddisk is crashed, no boot (needs physical access to the server)</h3>
<p>fsck -fCV /dev/md1<br />
mount /dev/md1 /mnt<br />
chroot /mnt<br />
lilo (kinda obsoleted, grub is the standard bootloader nowadays)<br />
exit<br />
umount /mnt</p>
<h3>How to check the harddisk partitions?</h3>
<p>fdisk -l</p>
<h3>How can I see errors in logs?</h3>
<p>tail -n 500 /var/log/messages<br />
tail -f /var/log/messages<br />
tail -f /var/log/mail.info<br />
tail -f /var/log/warn<br />
tail -f /var/log/mail.err<br />
tail -f /var/log/mail.warn<br />
tail -f /var/log/apache2/access_log<br />
tail -f /var/log/apache2/error_log</p>
<p>Article published in <a href="http://www.submitsuite.com/blog">Submit Suite Blog</a>.
<br/><br/><a href="http://www.submitsuite.com/blog/webmaster-manual-for-a-root-server-283">Webmaster manual for a root server</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.submitsuite.com/blog/webmaster-manual-for-a-root-server-283/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
