Difference between revisions of "Patch webOS Make USB Partition Writable via SFTP"
(New page: 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 ...) |
|||
(6 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{template:patch}} | ||
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... | 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 | * Pre with SSH and SFTP installed, and connected to WIFI | ||
* SFTP Client of some sort. (Nautilus, WinSCP, SSHFS, etc) | * SFTP Client of some sort. (Nautilus, WinSCP, SSHFS, etc) | ||
Line 8: | Line 9: | ||
//**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.**// | //**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]]]. | 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) | 2. Determine your uid (user id) and gid (group id) | ||
− | + | <pre><nowiki> | |
id | id | ||
Line 17: | Line 18: | ||
gregnuj@castle:/var/home/gregnuj$ id | gregnuj@castle:/var/home/gregnuj$ id | ||
uid=1001(gregnuj) gid=1001(gregnuj) | uid=1001(gregnuj) gid=1001(gregnuj) | ||
− | + | </nowiki></pre> | |
+ | |||
3. Edit /etc/fstab so /media/internal is mounted owned by your user id (group id recommended but not required) | 3. Edit /etc/fstab so /media/internal is mounted owned by your user id (group id recommended but not required) | ||
− | + | <pre><nowiki> | |
sudo vi /etc/fstab | sudo vi /etc/fstab | ||
− | + | </nowiki></pre> | |
+ | |||
Modify the /media/internal entry as follows: (note: use the values obtained from the id command) | Modify the /media/internal entry as follows: (note: use the values obtained from the id command) | ||
− | + | <pre><nowiki> | |
/dev/mapper/store-media /media/internal vfat uid=1001,gid=1001,utf8,shortname=mixed 0 0 | /dev/mapper/store-media /media/internal vfat uid=1001,gid=1001,utf8,shortname=mixed 0 0 | ||
− | + | </nowiki></pre> | |
+ | |||
4. Save the file by pressing <ESC>, followed by ":x" (w/o quotes) <ENTER> | 4. Save the file by pressing <ESC>, followed by ":x" (w/o quotes) <ENTER> | ||
Line 35: | Line 39: | ||
Option 2: | Option 2: | ||
− | + | <pre><nowiki> | |
cd /media | cd /media | ||
sudo umount /media/internal | sudo umount /media/internal | ||
sudo mount /media/internal | sudo mount /media/internal | ||
− | + | </nowiki></pre> | |
− | + | =Password-less Login (optional - for Linux or Mac)= | |
− | |||
1. Login to the Pre via SSH as your non-root user, and execute: | 1. Login to the Pre via SSH as your non-root user, and execute: | ||
− | + | <pre><nowiki> | |
mkdir ~/.ssh | mkdir ~/.ssh | ||
− | + | </nowiki></pre> | |
+ | |||
2. Generate a key pair on your host machine with: | 2. Generate a key pair on your host machine with: | ||
− | + | <pre><nowiki> | |
ssh-keygen -t rsa | ssh-keygen -t rsa | ||
− | + | </nowiki></pre> | |
3. Copy ~/.ssh/id_rsa.pub on the host to ~/.ssh/authorized_keys on the Pre. | 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. | 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. | * 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 /" | ||
+ | |||
+ | =Credits= | ||
natrixgli for original post. | natrixgli for original post. | ||
+ | |||
Atlanta for transferring to new Wiki | Atlanta for transferring to new Wiki |
Latest revision as of 05:18, 28 March 2010
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.
(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 /"
Credits
natrixgli for original post.
Atlanta for transferring to new Wiki