Setup SFTP

From WebOS Internals
Revision as of 01:20, 9 August 2009 by UltraBlack (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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

Once you have accessed Linux on 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 this wiki page.

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:

vi sudo 

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: Mount the Pre's file system as read-only:

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 at PreCentral.net