FORUMS
Remove All Ads from XDA

[Q] Android 4.2: "Public" folder for every user?

20 posts
Thanks Meter: 10
 
By ryazor, Junior Member on 17th November 2012, 01:05 PM
Post Reply Email Thread
Hi folks!
I searched the forum, but couldn't find a proper solution yet.

Is it possible to create a shared ("public") folder, which is accessible for every user on the N7?

As the user accounts seem to be managed under /data/media/ID I already tried:
  • adb shell
  • su
  • mkdir /data/media/pub
  • chmod 777 /data/media/pub
  • chown media_rw.media_rw /data/media/pub
  • ln -s /data/media/pub /data/media/0/pub

So logically the symlink is correct, unfortunately the user doesn't have access to /data/media (which I suspected), so the symlink to /data/media/pub is inaccessible for user 0.
Also other locations doesn't seem to work. On / and /mnt I cannot create a folder, as this is read-only mounted by default, and I don't want to fiddle around with various "mount -o rw/ro" scripts on bootup etc.

Does anybody managed to create a shared folder for every user?

Thanks in advance!
 
 
2nd December 2012, 10:42 AM |#2  
adonet's Avatar
Member
Flag Amsterdam, NL
Thanks Meter: 4
 
More
Quote:
Originally Posted by ryazor

Hi folks!
I searched the forum, but couldn't find a proper solution yet.

Is it possible to create a shared ("public") folder, which is accessible for every user on the N7?

As the user accounts seem to be managed under /data/media/ID I already tried:

  • adb shell
  • su
  • mkdir /data/media/pub
  • chmod 777 /data/media/pub
  • chown media_rw.media_rw /data/media/pub
  • ln -s /data/media/pub /data/media/0/pub

So logically the symlink is correct, unfortunately the user doesn't have access to /data/media (which I suspected), so the symlink to /data/media/pub is inaccessible for user 0.
Also other locations doesn't seem to work. On / and /mnt I cannot create a folder, as this is read-only mounted by default, and I don't want to fiddle around with various "mount -o rw/ro" scripts on bootup etc.

Does anybody managed to create a shared folder for every user?

Thanks in advance!

I'm having the same problem. I have a owner account in which I put some files (4 Gb) that should be available to every user. But user 10 and 11 can't access these files. Where Can I put those files, so that every account can easily access them?
17th February 2013, 07:59 PM |#3  
OP Junior Member
Flag Berlin
Thanks Meter: 10
 
More
I figured out that each user has a directory under /mnt/shell/emulated (0, 10, 11, etc.). So I created a directory "public" via root under /mnt/shell/emulated/public and made it worldwide writable via chmod -R 777 /mnt/shell/emulated/public. Afterwards I created public folders in each user directories.

It works like a charm when mounting via:

Code:
mount -o bind,allow_other /mnt/shell/emulated/public/ /mnt/shell/emulated/0/public/
I tried to build a simple script and it works when executing it in root shell via ADB. Unfortunately I didn't manage to automate this on boot. I couldn't find any "init.d" directory and also via "Script Manager - SManager" it wasn't working.

Code:
#!/system/bin/sh
PUBLIC_DIR=public
if [ -d /mnt/shell/emulated/$PUBLIC_DIR ]; then
    for USER_PATH in /mnt/shell/emulated/*; do 
        if [ -d $USER_PATH/$PUBLIC_DIR ]; then
            busybox mount -o bind,allow_other /mnt/shell/emulated/$PUBLIC_DIR $USER_PATH/$PUBLIC_DIR
        fi                                                                                  
    done                                                                                    
fi
Any ideas?
The Following User Says Thank You to ryazor For This Useful Post: [ View ] Gift ryazor Ad-Free
17th February 2013, 10:06 PM |#4  
adonet's Avatar
Member
Flag Amsterdam, NL
Thanks Meter: 4
 
More
Re: [Q] Android 4.2: "Public" folder for every user?
It's a start. It would be nice to incorporate it in an app.

It would be even better if it is a standard option in Android 4.2

Sent from my HTC Wildfire S A510e using xda app-developers app
18th February 2013, 07:31 AM |#5  
OP Junior Member
Flag Berlin
Thanks Meter: 10
 
More
Quote:
Originally Posted by adonet

It's a start. It would be nice to incorporate it in an app.

It would be even better if it is a standard option in Android 4.2

I agree. At the moment, it seems to be possible only with a lot of fiddle and root including busybox. I don't know, if Google ever will implement such a feature, since it kind of breaks the separation idea of multi user spaces.

I hope, I'm able to figure out, how to get the script working. Everything works except the mount line which requires root privileges. Furthermore the script works correctly when executed from root shell via ADB.

Regards!
25th February 2013, 09:29 PM |#6  
adonet's Avatar
Member
Flag Amsterdam, NL
Thanks Meter: 4
 
More
Re: [Q] Android 4.2: "Public" folder for every user?
Did the updated super SU change anything?

Sent from my HTC Wildfire S A510e using xda app-developers app
26th February 2013, 07:51 PM |#7  
adonet's Avatar
Member
Flag Amsterdam, NL
Thanks Meter: 4
 
More
Re: [Q] Android 4.2: "Public" folder for every user?
I found an easy to implement solution to make a shared directory on the Nexus 7

I used ES file-explorer and set the setting so that it had all the read and write permissions and can go upwards to /

Then I make a new directory in /storage/emulated and give it some name. E.g. /storage/emulated/allusers

Then select the properties of this directory and change it so that everyone has all available permissions.
Now copy the files you want to share in this directory and change the permissions of these files as well.

Now you van change to another account and still read and write these files.

It's a bit of a hassle but it works

★******************
Well I Was too quick. The directory I created suddenly disappeared. I can't find the contents anymore. Where o where would these files go?

Jeroen



Sent from my Nexus 7 using xda app-developers app
28th June 2013, 03:13 PM |#8  
Junior Member
Thanks Meter: 1
 
More
Has anyone tried “mkdir /data/media/legacy/pub" instead of “mkdir /data/media/pub"?

I noticed that every user has full access to this legacy folder... In fact, I kinda use this folder to move files between different users!
28th June 2013, 10:58 PM |#9  
adonet's Avatar
Member
Flag Amsterdam, NL
Thanks Meter: 4
 
More
Well, yes it works. Need to be root though. But it works. Thanks a lot.
11th March 2014, 12:42 AM |#10  
BigJArm's Avatar
Senior Member
Flag Idaho Falls
Thanks Meter: 90
 
More
I found a solution.

Use the android/obb folder since it is shared space. I added a Movies folder there can can access it from multiple accounts. For MX player to see the movie files I had to uncheck the recognize no media option under settings but it works.
11th March 2014, 02:24 PM |#11  
adonet's Avatar
Member
Flag Amsterdam, NL
Thanks Meter: 4
 
More
Thank you, I'll try this option too, Better than the solution mentioned above that needs root.
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes