Geek Posted September 30, 2011 Posted September 30, 2011 <div class="KonaBody"><p><img alt="Enable and use the SFTP server in Mac OS X Lion" src="http://osxdaily.com/wp-content/uploads/2011/09/enable-sftp-server-mac-os-x-lion.jpg" title="Enable and use the SFTP server in Mac OS X Lion" class="aligncenter" width="620" height="347" /></p> <p>Remote Login is a feature in Mac OS X’s Sharing preferences that allow remote users to connect to a Mac in a secure fashion by using OpenSSH. Essentially, it starts an SSH server, which includes SSH, the secure replacement for telnet, SFTP, the secure replacement for FTP, and SCP, for secure copying.</p> <p>The inclusion of SFTP through Remote Login also explains why Apple ditched the <a href="http://osxdaily.com/2011/09/29/start-an-ftp-or-sftp-server-in-mac-os-x-lion/">FTP server in Lion</a>, they opted for the infinitely more secure SFTP option and bundled it within Sharing’s “Remote Login” option. </p> <h2 style="font-size:1.3em;">Using Remote Login to Start the SSH Server in Mac OS X</h2> <p>These instructions are the same for OS X 10.7 Lion and 10.6:</p> <ul> <li>Open System Preferences and click on “Sharing”</li> <li>Select the checkbox next to “Remote Login” to enable it, like the screenshot above</li> </ul> <p>If you want to limit incoming SSH access to certain users, you can do so in the same preference panel by ticking “Only these users” and then manually adding them by clicking on the + icon. This brings up a list of Users & Groups on the Mac that you can select from. Think of this as an extra security step, although SSH by default is quite secure.</p> <p>Now that the SSH server has been enabled, you can verify they have enabled, go to the Terminal and type either ‘ssh localhost’ or ‘sftp localhost’ and you should see something like this: <code>$ sftp localhost The authenticity of host 'localhost (::1)' can't be established. RSA key fingerprint is b3:42:27:4a:b6:22:86:4b:c6:21:32:47:4b:8b:18:0d. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added 'localhost' (RSA) to the list of known hosts. Password:</code></p> <p>Connecting to localhost isn’t too useful though, and this is called Remote Login for a reason.</p> <h2 style="font-size:1.23em;">Connecting to the Mac’s SSH Server Remotely</h2> <p>Now that you have SSH up and running, connecting to it remotely is easy. The great thing about this is you can now connect to the Mac from virtually any other operating system, all you need is an SSH client. SSH clients are bundled with Mac OS X and Linux so there are no downloads necessary there, but <a href="http://osxdaily.com/2011/04/14/ssh-app-iphone-ipad-prompt/">iOS users can use Prompt</a> and Windows users can <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html">get PuTTY</a> (its free).</p> <p><strong>1) From the Mac functioning as an SSH Server:</strong></p> <ul> <li><a href="http://osxdaily.com/2010/11/21/find-ip-address-mac/">Get the Macs IP address</a> – Go to “System Preferences” and “Network” to retrieve the IP</li> </ul> <p><strong>2) Connecting to the Mac with SSH from another computer:</strong></p> <ul> <li>We’ll assume you’re using the Terminal in Mac OS X, so using the IP address that you just found, use the following command syntax:</li> <p><code>ssh username@ip.address</code></p> <li>This is what it would actually look like, using paul as the username and 192.168.0.25 as the server IP:</li> <p><code>ssh paul@192.168.0.25</code></p> <li>You will be asked to accept an RSA key to your known hosts list, so type “yes” and then you will be asked for the users password</li> <li>You’re now remotely connected to the Mac via SSH</li> </ul> <p>If you want to use SFTP or SCP instead, the procedure is the same except you use ‘sftp’ or ‘scp’ as the commands instead. Additionally, you can use SFTP from apps like CyberDuck, Transmit, or <a href="http://osxdaily.com/2011/02/07/ftp-from-mac/">from Mac OS X itself</a> to transfer files to and from the Mac from any other location.</p> <p>A few things to remember here: your local IP address (on a LAN) is different than your <a href="http://osxdaily.com/2009/12/08/what-is-my-ip-address-how-do-i-get-my-ip-address-in-mac-os-x/">external IP address</a> (to the outside world). The easiest way to get a machines external IP is by going to a site like ‘whatismyip.org’ but keep in mind that if the Mac is behind a router with a firewall, you would have to open the ports on the router to be able to access it. That process is different depending on the router and firewall in use, so it wouldn’t make much sense to cover it here.</p> <p>Finally, if you don’t mind the whole jailbrake thing, you can actually <a href="http://osxdaily.com/2011/08/04/ssh-to-iphone/">SSH into iPhones and iPads too</a> by setting up servers on iOS devices, but it’s a bit more complicated.</p> <p><em>Thanks to Izdexic for the post idea <a href="http://osxdaily.com/2011/09/29/start-an-ftp-or-sftp-server-in-mac-os-x-lion/#comment-245819">via comments</a></em></p> </div> <p><a href="http://feedads.g.doubleclick.net/~a/gnD4hUTUze00udskJSpIMfY8z2g/0/da"><img src="http://feedads.g.doubleclick.net/~a/gnD4hUTUze00udskJSpIMfY8z2g/0/di" border="0" ismap="true"></img></a><br/> <a href="http://feedads.g.doubleclick.net/~a/gnD4hUTUze00udskJSpIMfY8z2g/1/da"><img src="http://feedads.g.doubleclick.net/~a/gnD4hUTUze00udskJSpIMfY8z2g/1/di" border="0" ismap="true"></img></a></p><div class="feedflare"> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=PYxZyew46fc:xyPUTSQlUpw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=PYxZyew46fc:xyPUTSQlUpw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=PYxZyew46fc:xyPUTSQlUpw:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=PYxZyew46fc:xyPUTSQlUpw:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/osxdaily?i=PYxZyew46fc:xyPUTSQlUpw:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=PYxZyew46fc:xyPUTSQlUpw:7Q72WNTAKBA"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=7Q72WNTAKBA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/osxdaily?a=PYxZyew46fc:xyPUTSQlUpw:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/osxdaily?d=qj6IDK7rITs" border="0"></img></a> </div><img src="http://feeds.feedburner.com/~r/osxdaily/~4/PYxZyew46fc" height="1" width="1"/> View the full article
Recommended Posts