Difference between revisions of "Setup SFTP"

From WebOS Internals
Jump to navigation Jump to search
m (fixed link to next steps)
m (Updated terminology, "rooted" is a misnomer.)
Line 8: Line 8:
 
This document assumes you know why you want sftp, and how to use it once it's on the Pre.  
 
This document assumes you know why you want sftp, and how to use it once it's on the Pre.  
  
Step 1: Login to your [[Portal:Accessing_Linux | rooted]] Pre.  You must also have Optware packages configured, as outlined [[Next_steps|here]]:  
+
Step 1: [[Portal:Accessing_Linux | Login to your Pre's Linux shell]].  You must also have Optware packages configured, as outlined [[Next_steps|here]]:  
  
 
Step 2: Set Read/Write Access:
 
Step 2: Set Read/Write Access:

Revision as of 01:10, 29 July 2009

If you want the automated setup meta-package, go here


Once you have rooted your Pre, it would be nice to be able to get and put files off the Pre without having to switch to usb drive mode, and copy the files over,and switch back to user mode, and move the files out of the media/internal folder and so forth.

One good way to do this is via sftp. If you are not sure what that is, please visit [1].

This document assumes you know why you want sftp, and how to use it once it's on the Pre.

Step 1: Login to your Pre's Linux shell. You must also have Optware packages configured, as outlined here:

Step 2: Set Read/Write Access:

sudo -i
mount -o remount,rw /

Step 3: Install the needed components from ipkg-opt:

cd /opt/bin
ipkg-opt update
ipkg-opt install openssh-sftp-server

Step 4: Modify the sudoers file to allow your user account to sudo sftp-server without a password:

visudo 

Once in the file, add the following line after the existing ALL line for your user - where //myusername// should be replaced with the user account that you are using to access your Pre via SSH. The order of the lines count here :

Example:

myusername ALL=(ALL) ALL
myusername ALL=NOPASSWD: /opt/libexec/sftp-server

Quit and save your changes (ESC :wq)

Step 5: Readonly the Pre:

mount -o remount,ro /

Step 6: Reboot via one of the methods below:

Method 1:

su
/sbin/reboot

Method 2:

sudo su -l
reboot

Method 3: Turn off the Pre by holding the power button until the 'Turn Off' button appears and then pressing it. Turn the Pre back on after it has turned off by holding the power button until you see the Palm logo.

To Login to the Pre using winSCP:

Hostname: [my pre's ip]
port: [my pre's port] (222 if you followed the Optware enabling instructions verbatim)
username and password you set

Check 'Advanced Options' and select "Environment>SFTP".
In the SFTP server box enter: sudo /opt/libexec/sftp-server

Be sure to set "mount -o remount,rw /" to write and "mount -o remount,ro /" when done. (If on Windows, do this through PuTTY. I haven't found a way to do it through WinSCP, but you can go to "Commands>Open in PuTTY" from the main toolbar.)


Courtesy of jhoff80 and blakeb @ precentral.net