Patch webOS Make USB Partition Writable via SFTP

From WebOS Internals
Revision as of 04:18, 28 March 2010 by Devnull (talk | contribs) (Possible Issues)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
<<- Return to webOS Patches

You can use the USB Drive partition via WIFI as a non-root user by telling fstab to mount it owned by the non-root user's UID. This is useful if you don't want to have to remount the root partition, and if you don't want r/w access enabled for the entire filesystem when just transferring files...


  • Pre with SSH and SFTP installed, and connected to WIFI
  • SFTP Client of some sort. (Nautilus, WinSCP, SSHFS, etc)
  • You'll have to update your configuration if the IP of your Pre changes

//**Note: If the Pre is on battery, the SSH connection will lost when the display goes to sleep. Do this while the Pre is charging for best results.**//


1. Login via SSH as the non-root user you created when you enabled [[[adding-the-ipkg-repository | the Optware Package Feed]]]. 2. Determine your uid (user id) and gid (group id)


gregnuj@castle:/var/home/gregnuj$ id
uid=1001(gregnuj) gid=1001(gregnuj)

3. Edit /etc/fstab so /media/internal is mounted owned by your user id (group id recommended but not required)

sudo vi /etc/fstab

Modify the /media/internal entry as follows: (note: use the values obtained from the id command)

/dev/mapper/store-media	/media/internal	vfat	uid=1001,gid=1001,utf8,shortname=mixed	0	0

4. Save the file by pressing <ESC>, followed by ":x" (w/o quotes) <ENTER>

5. Option 1: Reboot the Pre and you should now be able to read/write to the USB Drive partition (/media/internal) via SFTP using your non-root login.

OR instead of rebooting

Option 2:

cd /media
sudo umount /media/internal
sudo mount /media/internal

Password-less Login (optional - for Linux or Mac)

1. Login to the Pre via SSH as your non-root user, and execute:

mkdir ~/.ssh

2. Generate a key pair on your host machine with:

ssh-keygen -t rsa

3. Copy ~/.ssh/ on the host to ~/.ssh/authorized_keys on the Pre. 4. Test SSH/SFTP login from the host to the Pre to make sure you aren't asked for a password.

Possible Issues

  • If the Pre is running on battery, it sleeps frequently, breaking the SFTP connection. This will cause file transfers to fail.

(Not sure where to put this)

Problem: Unable to edit fstab file if system is read-only. Can't set file system to RW unless you are root.

Solution: After executing the "ID" command and getting your UID and GID number type "sudo -s" then "mount -o remount,rw /". (No quotation marks) After you can proceed to edit the fstab file with your original numbers (which you get BEFORE you switch to root). After mount read-only "mount -o remount,ro /

Alternative Solution: Open a second terminal window and type "sudo -s" then "mount -o remount,rw /". (No quotation marks) Then you can do this patch on a new window. After you are done change back to read-only "sudo -s" then "mount -o remount,ro /"


natrixgli for original post.

Atlanta for transferring to new Wiki