Patch webOS Make USB Partition Writable via SFTP

From WebOS Internals
Revision as of 05:30, 12 August 2009 by Hopspitfire (talk | contribs) (adding patch template header)
Jump to navigation Jump to search


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...

Requirements

  • 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.**//

Instructions

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)

id

Example:
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/id_rsa.pub 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.

Credits

natrixgli for original post.

Atlanta for transferring to new Wiki