<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DZone Snippets: ssh code</title>
    <link>http://snippets.dzone.com/posts</link>
    <pubDate>Sun, 27 Jul 2008 05:45:21 GMT</pubDate>
    <description>DZone Snippets: ssh code</description>
    <item>
      <title>Push your public key to a server</title>
      <link>http://snippets.dzone.com/posts/show/5730</link>
      <description>If you've already created your ssh keys locally do this to push the public key to a server so you won't have to login to the server everytime you ssh or cap deploy. &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt; cat .ssh/id_rsa.pub | ssh deploy@myserver.com "cat &gt;&gt; .ssh/authorized_keys2"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 07 Jul 2008 11:42:26 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5730</guid>
      <author>humblefrog (Steve)</author>
    </item>
    <item>
      <title>server monitoring</title>
      <link>http://snippets.dzone.com/posts/show/5611</link>
      <description># servers.sh&lt;br /&gt;export MAILSERVERS="server1 server2 server3"&lt;br /&gt;export WEBSERVERS="www1 www2 www3 www4"&lt;br /&gt;&lt;br /&gt;#!/bin/bash&lt;br /&gt;### Assess disk space on mail servers&lt;br /&gt;source ./servers.sh&lt;br /&gt;for i in ${MAILSERVERS} ; do&lt;br /&gt;       echo =========${i} =============&lt;br /&gt;       ssh root@${i} "df"&lt;br /&gt;       echo ============ =============&lt;br /&gt;done&lt;br /&gt;&lt;br /&gt;# min   hour    dom     month   dow     command&lt;br /&gt;&lt;br /&gt;grep &#8220;###&#8221; *</description>
      <pubDate>Sat, 07 Jun 2008 14:43:51 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5611</guid>
      <author>shantanuo (shantanu oak)</author>
    </item>
    <item>
      <title>Copy Public Key To Host In One Line</title>
      <link>http://snippets.dzone.com/posts/show/5258</link>
      <description>&lt;code&gt;&lt;br /&gt;ssh username@host "echo `cat ~/.ssh/id_dsa.pub` &gt;&gt; ~/.ssh/authorized_keys"&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Wed, 19 Mar 2008 18:23:53 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/5258</guid>
      <author>timmorgan (Tim Morgan)</author>
    </item>
    <item>
      <title>Using Ruby to list directory names from a remote machine</title>
      <link>http://snippets.dzone.com/posts/show/4924</link>
      <description>The first line of code  executes an external shell command which retrieves directory names into an array. The second line of code displays each directory making sure to chop the '/', and '\n' from the name.&lt;br /&gt;&lt;code&gt;&lt;br /&gt;dir_listing = `ssh 192.168.1.10 'ls */ -d'`&lt;br /&gt;dir_listing.each { |directory| puts directory.chop.chop }&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;Note: In this example ssh access to the remote machine does not prompt the user for a password as the hosts know each other. see ssh-keygen.</description>
      <pubDate>Tue, 25 Dec 2007 11:13:26 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4924</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>copy files using rsync and ssh</title>
      <link>http://snippets.dzone.com/posts/show/4717</link>
      <description>source: http://www.mikerubel.org/computers/rsync_snapshots/#Abstract ; switches: -a = archive mode -e specifies the remote shell to use&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;rsync -a -e ssh source/ username@remotemachine.com:/path/to/destination/&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Tue, 30 Oct 2007 13:03:36 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4717</guid>
      <author>jrobertson (James Robertson)</author>
    </item>
    <item>
      <title>Compress file in SSH</title>
      <link>http://snippets.dzone.com/posts/show/4686</link>
      <description>The below will compress a file or folder in .tar.gz format in SSH.&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;tar -zcvf &lt;new_tar_filename&gt;.tar.gz &lt;filename/directory&gt;&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Mon, 22 Oct 2007 11:38:10 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/4686</guid>
      <author>nothingless (Sasha)</author>
    </item>
    <item>
      <title>Mount SSH using MacFUSE</title>
      <link>http://snippets.dzone.com/posts/show/3342</link>
      <description>This will also list the voume in the Finder, thanks to the volname option (I think)&lt;br /&gt;&lt;br /&gt;&lt;code&gt;mkdir -p ~/mnts/formandfx&lt;br /&gt;sshfs kmarsh@formandfx.com: ~/mnts/formandfx -oping_diskarb,volname=formandfx&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 21 Jan 2007 23:14:06 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3342</guid>
      <author>willcodeforfoo ()</author>
    </item>
    <item>
      <title>Connecting to a local database on a remote machine</title>
      <link>http://snippets.dzone.com/posts/show/3138</link>
      <description>I had a MySQL instance on a remote server that had only local access. I wanted to connect to that database via my local copy of CocoaMysql. Using ssh portforwarding you can  do it like this: &lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ssh -N -L &lt;port_number&gt;:127.0.0.1:3306 remote_machine&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;&lt;br /&gt;so you can now open CocoaMysql and connect to localhost, bla, bla but if you use the &lt;port_number&gt; assigned above you should see your remote database.</description>
      <pubDate>Tue, 12 Dec 2006 21:10:46 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/3138</guid>
      <author>whomwah (Duncan Robertson)</author>
    </item>
    <item>
      <title>ssh and scp without typing a password each time</title>
      <link>http://snippets.dzone.com/posts/show/2700</link>
      <description>* You can create and exchange ssh keys to avoid repeatedly typing your password.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;Source:      ssh-keygen -t dsa                                     Type this once per log-in session&lt;br /&gt;Source:      Now copy the .ssh/id_dsa.pub file to &lt;Destination&gt;.&lt;br /&gt;Source:      scp .ssh/id_dsa.pub userid@&lt;Destination&gt;:tempid        we've renamed it tempid.&lt;br /&gt;Destination: cat tempid &gt;&gt; .ssh/authorized_keys                     &lt;br /&gt;add the contents of tempid to .ssh/authorized_keys.&lt;br /&gt;Destination: rm tempid. &lt;br /&gt;&lt;/pre&gt;</description>
      <pubDate>Sat, 23 Sep 2006 18:33:56 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2700</guid>
      <author>nevadalife (nevada)</author>
    </item>
    <item>
      <title>SSH Key Pairs Stuff</title>
      <link>http://snippets.dzone.com/posts/show/2478</link>
      <description>//allows for copying of ssh keys&lt;br /&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;ssh-keygen -t dsa&lt;br /&gt;ssh user@host 'cat &gt;&gt; .ssh/authorizedkeys' &lt; .ssh/id_dsa.pub&lt;br /&gt;&lt;/code&gt;</description>
      <pubDate>Sun, 27 Aug 2006 22:47:31 GMT</pubDate>
      <guid>http://snippets.dzone.com/posts/show/2478</guid>
      <author>jnunemaker ()</author>
    </item>
  </channel>
</rss>
