Friday, May 3, 2024
 Popular · Latest · Hot · Upcoming
21
rated 0 times [  21] [ 0]  / answers: 1 / hits: 69588  / 1 Year ago, mon, january 23, 2023, 9:39:48

I installed Ubuntu and Windows on my MacBook and Ubuntu is my primary OS; however, all of my media stays on my OSX partition. I want to be able to access it (at least my OSX user's home folder) from Ubuntu without having to launch a media player (or anything else) as root. Also, because I occasionally want to fire up my machine in OSX, I don't want to change anything that I would need to change back frequently (I read a lot about changing UID--I don't exactly understand what this entails, but I wouldn't want to have to change my UID back and forth depending on which OS I'm using. Similarly, I don't want to change file system permissions back and forth).



Also, I saw something about a "noowner" option, but that doesn't seem to do what I want it to.



So I guess I'd like to be able to do something like this:



sudo mount -t hfsplus -o noowner /dev/sda2/ /media/Mac


And then be able to access all of my media (at least everything in my OSX user's Home folder) without dropping in as root. (for clarity: the above command line entry doesn't do what I want it to do, but I want to be able to do something similar).



Or would it be better to change my UID? And if so, how?


More From » mount

 Answers
1

I wasn't able to figure out how to ignore the permissions, but I ended up changing the UID on my Ubuntu account to match my OSX account:



sudo useradd -d /home/tempuser -m -s /bin/bash -G admin tempuser
sudo passwd tempuser


Enter new password. Log out, log in as "other" with username "tempuser" and the password you chose earlier. Open a terminal and type:



sudo usermod --uid 501 yourusername
sudo chown -R 501:yourusername /home/yourusername


*change "yourusername" to your non-temporary user name and 501 to the UID of your Mac account (first Mac account starts at 501, but subsequent users will have different UIDs).



Log out of tempuser and log back into your normal account (this is important; don't just switch users--bad things happen). Open a terminal window and type:



sudo userdel -r tempuser


For more details, visit this page.



Caveats




  • Only one linux user can gain access. This setup will not allow multiple linux users to access multiple user directories on the HFS+ drive. This is because Apple locks down user directories (and media directories like Music) to 700 (rwx------).

  • Once you change your UID the login manager will stop listing that user. You have to change the UID_MIN option in /etc/login.def from 1000 to 500.

  • Finally because the user UID has changed, access to the drive becomes a permissions confusion. You will have to note the exact location of your user's home folder to view it. Tab completions and browsing through the file manager will become problematic to folders outside the original Apple user's home folder without sudo.


[#40643] Tuesday, January 24, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
olouredping

Total Points: 259
Total Questions: 100
Total Answers: 121

Location: New Caledonia
Member since Wed, Sep 15, 2021
3 Years ago
olouredping questions
;