<?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>Anti HostMonster &#187; ssh</title>
	<atom:link href="http://www.antihostmonster.com/tag/ssh/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.antihostmonster.com</link>
	<description>Do not fool us</description>
	<lastBuildDate>Mon, 21 Jun 2010 11:54:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Things to help when migrating from one server to another</title>
		<link>http://www.antihostmonster.com/2009/03/things-to-help-when-migrating-from-one-server-to-another/</link>
		<comments>http://www.antihostmonster.com/2009/03/things-to-help-when-migrating-from-one-server-to-another/#comments</comments>
		<pubDate>Wed, 04 Mar 2009 04:50:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SSH Commands]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.antihostmonster.com/?p=26</guid>
		<description><![CDATA[Good thing to have ssh access set up for both webhosts. An easy way of migrating the databases especially when it is a big database and it size is over what you have in PhpMyAdmin setup: Login to the new server with ssh and type: mysqldump -h oldhost -u oldusername -poldpassword olddbname &#124; mysql -h [...]]]></description>
			<content:encoded><![CDATA[<p>Good thing to have ssh access set up for both webhosts.</p>
<p>An easy way of migrating the databases especially when it is a big database and it size is over what you have in PhpMyAdmin setup:<br />
Login to the new server with ssh and type:<br />
<span style="color: #ffff00;">mysqldump -h oldhost -u oldusername -poldpassword olddbname | mysql -h newhost -u newusername -pnewpassword newdbname</span></p>
<p>Note: if this did not work check your passwords or check if your new server is white listed (remote mysql access) on the old server.</p>
<p>Below is a list of common SSH commands that can be very useful I will be updating this as I suffer through my hosting (Article provided by WebHostGear.com):</p>
<p><strong>Common SSH Commands or Linux Shell Commands,</strong><br />
<span style="color: #ffff00;"><strong>ls </strong></span>: list files/directories in a directory, comparable to dir in windows/dos.<br />
<span style="color: #ffff00;"><em>ls -al</em></span> : shows all files (including ones that start with a period), directories, and details attributes for each file.</p>
<p><span style="color: #ffff00;">ls -alF</span>: shows all files and its owners</p>
<p><span style="color: #ffff00;"><strong>cd </strong></span>: change directory · · cd /usr/local/apache : go to /usr/local/apache/ directory<br />
<em><span style="color: #ffff00;">cd ~</span> </em>: go to your home directory<br />
<span style="color: #ffff00;"><em>cd -</em> </span>: go to the last directory you were in<br />
<span style="color: #ffff00;"><em>cd .. </em></span>: go up a directory cat : print file contents to the screen</p>
<p><span style="color: #ffff00;"><em>cat filename.txt </em></span>: cat the contents of filename.txt to your screen</p>
<p><strong><span style="color: #ffff00;">chmod</span>:</strong> changes file access permissions<br />
The set of 3 go in this order from left to right:<br />
USER &#8211; GROUP &#8211; EVERONE<br />
<!-- COPYRIGHT MIDDLE ART --></p>
<p><!-- END COPYRIGHT MIDDLE ART --><script src="http://a.wavepointmedia.net/adx.js" type="text/javascript"></script> <script type="text/javascript"></script><noscript></noscript><br />
1 = &#8211;X  Execute only<br />
2 = -W-  Write only<br />
3 = -WX  Write and execute<br />
4 = R&#8211;  Read only<br />
5 = R-X  Read and execute<br />
6 = RW-  Read and write<br />
7 = RWX  Read, write and execute</p>
<p>Usage:<br />
chmod numberpermissions filename</p>
<p><span class="green">chmod 000</span> : No one can access<br />
<span class="green">chmod 644</span>: Usually for HTML pages<br />
<span class="green">chmod 755</span>: Usually for CGI scripts</p>
<p><span style="color: #ffff00;"><strong>chown</strong></span>: changes file ownership permissions<br />
The set of 2 go in this order from left to right:<br />
USER &#8211; GROUP</p>
<p><span style="color: #ffff00;"><span class="green">chown root myfile.txt</span></span> : Changes the owner of the file to root<br />
<span style="color: #ffff00;"><span class="green">chown root.root myfile.txt</span></span> : Changes the owner and group of the file to root</p>
<p><span style="color: #ffff00;">chown -Rf Username Foldername </span>: Changes the owner of a directory and all files in it</p>
<p><span style="color: #ffff00;"><strong>tail</strong></span> : like cat, but only reads the end of the file<br />
<em><span style="color: #ffff00;">tail /var/log/messages</span> </em>: see the last 20 (by default) lines of /var/log/messages<br />
<span style="color: #ffff00;"><em>tail -f /var/log/messages </em></span>: watch the file continuously, while it&#8217;s being updated<br />
<span style="color: #ffff00;"><em>tail -200 /var/log/messages </em></span>: print the last 200 lines of the file to the screen</p>
<p><span style="color: #ffff00;"><strong>more</strong><em> </em></span>: like cat, but opens the file one screen at a time rather than all at once<br />
<em><span style="color: #ffff00;">more /etc/userdomains</span> </em>: browse through the userdomains file. hit <em>Space</em>to go to the next page, <em>q</em> to quit</p>
<p><span style="color: #ffff00;"><strong>pico</strong></span> : friendly, easy to use file editor<br />
<span style="color: #ffff00;"><em>pico /home/burst/public_html/index.html </em></span>: edit the index page for the user&#8217;s website.</p>
<p><strong>File Editing with VI ssh commands</strong><br />
<span style="color: #ffff00;"><strong>vi</strong> </span>: another editor, tons of features, harder to use at first than pico<br />
<em><span style="color: #ffff00;">vi /home/burst/public_html/index.html</span> </em>: edit the index page for the user&#8217;s website.<br />
When in the vi program you can use the following useful commands, you will need to hit SHIFT + : to go into command mode</p>
<p><span class="green">:q! </span>: This force quits the file without saving and exits vi<br />
<span class="green">:w</span> : This writes the file to disk, saves it<br />
<span class="green">:wq</span> : This saves the file to disk and exists vi<br />
<span class="green">:LINENUMBER</span> : EG :25 : Takes you to line 25 within the file<br />
<span class="green">:$ </span>: Takes you to the last line of the file<br />
<span class="green">:0</span> : Takes you to the first line of the file</p>
<p><span style="color: #ffff00;"><strong>grep</strong></span> : looks for patterns in files<br />
<span style="color: #ffff00;"><em>grep root /etc/passwd </em></span>: shows all matches of root in /etc/passwd<br />
<em><span style="color: #ffff00;">grep -v root /etc/passwd</span> </em>: shows all lines that do not match root</p>
<p><span style="color: #ffff00;"><strong>ln</strong></span> : create&#8217;s &#8220;links&#8221; between files and directories<br />
<em>ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf </em>: Now you can edit /etc/httpd.conf rather than the original. changes will affect the orginal, however you can delete the link and it will not delete the original.</p>
<p><span style="color: #ffff00;"><strong>last</strong> </span>: shows who logged in and when<br />
<em><span style="color: #ffff00;">last -20</span> </em>: shows only the last 20 logins<br />
<em><span style="color: #ffff00;">last -20 -a</span> </em>: shows last 20 logins, with the hostname in the last field</p>
<p><span style="color: #ffff00;"><strong>w</strong></span> : shows who is currently logged in and where they are logged in from.<br />
<span style="color: #ffff00;"><span class="green">who</span></span> : This also shows who is on the server in an shell.</p>
<p><span style="color: #ffff00;"><strong>netstat</strong> </span>: shows all current network connections.<br />
<span style="color: #ffff00;"><em>netstat -an </em>:</span> shows all connections to the server, the source and destination ips and ports.<br />
<span style="color: #ffff00;"><em>netstat -rn </em></span>: shows routing table for all ips bound to the server.</p>
<p><span style="color: #ffff00;"><strong>top</strong></span> : shows live system processes in a nice table, memory information, uptime and other useful info. This is excellent for managing your system processes, resources and ensure everything is working fine and your server isn&#8217;t bogged down.<br />
<em>top</em> then type <em>Shift + M</em> to sort by memory usage or <em>Shift + P </em>to sort by CPU usage</p>
<p><strong><span style="color: #ffff00;">ps</span>: </strong>ps is short for process status, which is similar to the <em>top</em> command. It&#8217;s used to show currently running processes and their PID.<br />
A process ID is a unique number that identifies a process, with that you can kill or terminate a running program on your server (see kill command).<br />
<span style="color: #ffff00;"><em>ps U username</em> </span><em>:</em> shows processes for a certain user<br />
<span style="color: #ffff00;"><em>ps aux</em></span> : shows all system processes<br />
<span style="color: #ffff00;"><em>ps aux &#8211;forest</em> </span>: shows all system processes like the above but organizes in a hierarchy that&#8217;s very useful!</p>
<p><span style="color: #ffff00;"><strong>touch</strong></span> : create an empty file<br />
<em>touch /home/burst/public_html/404.html </em>: create an empty file called 404.html in the directory /home/burst/public_html/</p>
<p><span style="color: #ffff00;"><strong>file </strong></span>: attempts to guess what type of file a file is by looking at it&#8217;s content.<br />
<em><span style="color: #ffff00;">file *</span> </em>: prints out a list of all files/directories in a directory</p>
<p><strong><span style="color: #ffff00;">du</span> </strong>: shows disk usage.<br />
<em><span style="color: #ffff00;">du -sh</span> </em>: shows a summary, in human-readble form, of total disk space used in the current directory, including subdirectories.<br />
<em><span style="color: #ffff00;">du -sh *</span> </em>: same thing, but for each file and directory. helpful when finding large files taking up space.</p>
<p><strong><span style="color: #ffff00;">wc </span>: </strong>word count<br />
<em><span style="color: #ffff00;">wc -l filename.txt</span> </em>: tells how many lines are in filename.txt</p>
<p><strong><span style="color: #ffff00;">cp</span> </strong>: copy a file<br />
<span style="color: #ffff00;"><em>cp filename filename.backup </em></span>: copies filename to filename.backup<br />
<em><strong><span style="color: #ffff00;">cp -a /home/burst/new_design/* /home/burst/public_html/</span></strong> </em>: copies all files, retaining permissions form one directory to another.<br />
<span style="color: #ffff00;"><span class="green">cp -av * ../newdir</span></span> : Copies all files and directories recurrsively in the current directory INTO newdir</p>
<p><span style="color: #ffff00;"><strong>mv</strong></span> : Move a file command<br />
<span style="color: #ffff00;"><span class="green">mv oldfilename newfilename </span></span>: Move a file or directory from oldfilename to newfilename</p>
<p><strong><span style="color: #ffff00;">rm</span> </strong>: delete a file<br />
<em><span style="color: #ffff00;">rm filename.txt</span> </em>: deletes filename.txt, will more than likely ask if you really want to delete it<br />
<em><span style="color: #ffff00;">rm -f filename.txt</span> </em>: deletes filename.txt, will not ask for confirmation before deleting.<br />
<span style="color: #ffff00;"><em>rm -rf tmp/</em> :</span> recursively deletes the directory tmp, and all files in it, including subdirectories. BE VERY CAREFULL WITH THIS COMMAND!!!<br />
<strong><br />
<span style="color: #ffff00;">TAR</span></strong>: Creating and Extracting .tar.gz and .tar files<br />
<span style="color: #ffff00;"><span class="green">tar -zxvf file.tar.gz</span> :</span> Extracts the file<br />
<span style="color: #ffff00;"><span class="green">tar -xvf file.tar</span></span> : Extracts the file<br />
<span style="color: #ffff00;"><span class="green">tar -cf archive.tar contents/</span></span> : Takes everything from contents/ and puts it into archive.tar<br />
<span style="color: #ffff00;"><span class="green">gzip -d filename.gz</span> </span>: Decompress the file, extract it</p>
<p><span style="color: #ffff00;"><strong>ZIP Files</strong><span style="color: #000000;">:</span></span><span style="color: #000000;"> </span> Extracting .zip files shell command<br />
<span style="color: #ffff00;"><span class="green">unzip file.zip</span></span></p>
<p><strong>Firewall - iptables commands<br />
</strong><span style="color: #ffff00;"><span class="green">iptables -I INPUT -s IPADDRESSHERE -j DROP</span></span> : This command stops any connections from the IP address<br />
<span class="green"><span style="color: #ffff00;">iptables -L</span> </span>: List all rules in iptables<br />
<span style="color: #ffff00;"><span class="green">iptables -F</span></span> : Flushes all iptables rules (clears the firewall)<br />
<span style="color: #ffff00;"><span class="green">iptables &#8211;save</span></span> : Saves the currenty ruleset in memory to disk<br />
<span style="color: #ffff00;"><span class="green">service iptables restart</span></span> : Restarts iptables</p>
<p><strong>Apache Shell Commands</strong><br />
<span style="color: #ffff00;"><span class="green">httpd -v</span></span> : Outputs the build date and version of the Apache server.<br />
<span style="color: #ffff00;"><span class="green">httpd -l</span></span> : Lists compiled in Apache modules<br />
<span style="color: #ffff00;"><span class="green">httpd status</span></span> : Only works if mod_status is enabled and shows a page of active connections<br />
<span style="color: #ffff00;"><span class="green">service httpd restart</span></span> : Restarted Apache web server</p>
<p><strong>MySQL Shell Commands</strong><br />
<span style="color: #ffff00;"><span class="green">mysqladmin processlist</span></span> : Shows active mysql connections and queries<br />
<span style="color: #ffff00;"><span class="green">mysqladmin drop databasenamehere</span></span> : Drops/deletes the selected database<br />
<span style="color: #ffff00;"><span class="green">mysqladmin create databasenamehere</span> </span>: Creates a mysql database</p>
<p>Restore MySQL Database Shell Command<br />
<span style="color: #ffff00;"><span class="green">mysql -u username -ppassword -h webhost databasename &lt; databasefile.sql</span> : Restores a MySQL database from databasefile.sql</span></p>
<p>Backup MySQL Database Shell Command<br />
<span style="color: #ffff00;"><span class="green">mysqldump -u username -ppassword -h webhost databasename &gt; databasefile.sql </span>: Backup MySQL database to databasefile.sql</span></p>
<p><strong><span style="color: #ffff00;">kill</span>: </strong>terminate a system process<br />
<em>kill -9 PID</em> EG: <em>kill -9 431<br />
kill PID </em>EG: <em>kill 10550</em><br />
Use <em>top</em> or <em>ps ux </em>to get system PIDs (Process IDs)</p>
<p>EG:</p>
<table border="0">
<tbody>
<tr>
<td>PID</td>
<td>TTY</td>
<td>TIME</td>
<td>COMMAND</td>
</tr>
<tr>
<td>10550</td>
<td>pts/3</td>
<td>0:01</td>
<td>/bin/csh</td>
</tr>
<tr>
<td>10574</td>
<td>pts/4</td>
<td>0:02</td>
<td>/bin/csh</td>
</tr>
<tr>
<td>10590</td>
<td>pts/4</td>
<td>0:09</td>
<td>APP</td>
</tr>
</tbody>
</table>
<p>Each line represents one process, with a process being loosely defined as a running instance of a program. The column headed PID (process ID) shows the assigned process numbers of the processes. The heading COMMAND shows the location of the executed process.</p>
<p><strong>Putting commands together</strong><br />
Often you will find you need to use different commands on the same line. Here are some examples. Note that the | character is called a pipe, it takes date from one program and pipes it to another.<br />
<em>&gt;</em> means create a new file, overwriting any content already there.<br />
<em>&gt;&gt;</em> means tp append data to a file, creating a newone if it doesn not already exist.<br />
<em>&lt;</em> send input from a file back into a command.</p>
<p><em>grep User /usr/local/apache/conf/httpd.conf |more<br />
</em>This will dump all lines that match User from the httpd.conf, then print the results to your screen one page at a time.</p>
<p><span style="color: #ffff00;"><em>last -a &gt; /root/lastlogins.tmp</em></span><br />
This will print all the current login history to a file called lastlogins.tmp in /root/</p>
<p><em><span style="color: #ffff00;">tail -10000 /var/log/exim_mainlog |grep domain.com |more</span><br />
</em>This will grab the last 10,000 lines from /var/log/exim_mainlog, find all occurances of domain.com (the period represents &#8216;anything&#8217;,<br />
&#8211; comment it out with a so it will be interpretted literally), then send it to your screen page by page.</p>
<p><em><span style="color: #ffff00;">netstat -an |grep :80 |wc -l</span><br />
</em>Show how many active connections there are to apache (httpd runs on port 80)</p>
<p><em><span style="color: #ffff00;">mysqladmin processlist |wc -l</span><br />
</em>Show how many current open connections there are to mysql</p>
]]></content:encoded>
			<wfw:commentRss>http://www.antihostmonster.com/2009/03/things-to-help-when-migrating-from-one-server-to-another/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Midnight Commander</title>
		<link>http://www.antihostmonster.com/2009/03/midnight-commander/</link>
		<comments>http://www.antihostmonster.com/2009/03/midnight-commander/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 02:15:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[SSH Commands]]></category>
		<category><![CDATA[server installation]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[vps]]></category>

		<guid isPermaLink="false">http://www.antihostmonster.com/?p=19</guid>
		<description><![CDATA[Midnight Commander is a file manager for free operating systems if you are not a keyboard guy and would still like to use SSH it is a very powerfull tool. For me it is the first thing I need to install found a good command for it after hours of search&#8230; So how to install [...]]]></description>
			<content:encoded><![CDATA[<p>Midnight Commander is a file manager for free operating systems if you are not a keyboard guy and would still like to use SSH it is a very powerfull tool.</p>
<p>For me it is the first thing I need to install found a good command for it after hours of search&#8230; So how to install Midnight Commander login in SSH with root user and:</p>
<p><span style="color: #ffff00;">yum install mc</span><br />
and I also need</p>
<p><span style="color: #ffff00;">yum install unzip<br />
</span></p>
<p>Easy huh <img src='http://www.antihostmonster.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.antihostmonster.com/2009/03/midnight-commander/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
