How to share files between a regular account and a work account?
I've researched and I can't find anything. What I am missing?
It might not always be possible to transfer data between multiple users/profiles. It depends on the Device/Work Policy Controller app, installed by you or your IT admin.
Android device can be managed in two ways: fully managed (which is setup at the time of first use or after factory reset on a company owned device) and work profiles (which can be added or removed anytime without affecting primary profile on a personal device / BYOD). Both requires a profile owner app (MDM/DPC/EMM) installed and registered as an administrator. Fully-managed devices may further have work profiles and it provides more isolation and control on device-wide policies than the latter. See a comparison of both modes under Building DPC (1, 2, 3, 4) and Employing Managed Profiles (5) in Android documentation.
Multiple users can also be added if enabled in ROM by OEM/ROM developer. Being more isolated than profiles, interacting with users requires INTERACT_ACROSS_USERS
which is a permission with signature|system
protection level. So third party apps cannot use it at all.
Irrespective of if the secondary user is a human user or personal profile owner or work profile owner, the primary intention is data isolation. As defined here:
"A work profile securely isolates work apps and data from personal apps and data."
And as explained here, file sharing between device owner and work profile must only be through intents
(fired with content URIs), not file paths. But a profile owner may completely disallow data sharing (and IPC/intents
) between users/profiles. For instance see DISALLOW_SHARE_INTO_MANAGED_PROFILE
, DISALLOW_USB_FILE_TRANSFER
, DISALLOW_MOUNT_PHYSICAL_MEDIA
, addCrossProfileIntentFilter
.
Since Android 9 adb
is also disallowed to access file belonging to secondary user/profile. For details see How to access multi-user storage in adb shell
on Android 9+?
However if the sharing is not disallowed, you'll see options to switch to other profiles (tabs in Share Sheet on Android 11+) when sharing files:
Shelter - a free and open source app (I've no affiliation) that leverages the "Work Profile" feature to provide an isolated space for cloning apps - acts as a content (media) provider and provides "File Shuttle" option which lets you access Work Profile files from Personal Profile through "Storage Access Framework":
You can also run a small http
/ftp
server for file sharing on either side, or sync to cloud storage, if not restricted by policy.
So it entirely depends on the profile creator's policy if file sharing is allowed or not, usually not desirable in a corporate environment. However following method may work in all situations:
The most widely used trick for file sharing among multiple users is Android/obb
directory which is shared among users to save storage space. Sharing was managed using bind-mounts in early days but then handling was added to FUSE/sdcardfs
internally. However sharing is deprecated in Android 10 introducing mount option unshared_obb
in sdcardfs
.
So up to Android 9 you can use obb
directory for file sharing among users/profiles:
~# mkdir -p /storage/emulated/*/Android/obb; touch /sdcard/Android/obb/test_file
~# ls /storage/emulated/*/Android/obb/* /storage/emulated/obb/*
/storage/emulated/0/Android/obb/test_file /storage/emulated/10/Android/obb/test_file /storage/emulated/obb/test_file
permissive
SELinux context. You can always access all users' files from /data/media/
. Not sure how you are doing it.
Commented
Jul 27, 2021 at 15:48
Found a very simple way, just using web browsers in both work and regular profiles.
Open a browser in each profile and browse to snapdrop.net URL, which should open a session with a random username that will appear on the other brother and vice versa. By clicking the username icon you can send a file which should show up in the browser from the other profile. Then you can accept and download the file.
This doesn't need any third party app or server setup and data only transit on the phone (snapdrop only being used as a synchronization server for websockets). During file transfer, clients directly talk to each others and do not send data outside.
Use Total commander for Android or other 3rd-party file managers where you are able to use "Share via.." and the app will save the files in a new destination.
E.g. the steps:
I just solved this for myself by -
Quick fix!
I managed to transfer files via Total Commander's WiFi plugin. Both users should have TC + Wifi plugin installed. One of them is set up as a server and will present you with a QR code. Take a photo of the code with your phone.
The other user then scans this QR code from the phone and you can transfer files easily between the to users as long as the server is running.
I found a simple solution which doesn't limit you to one file at a time and allows sharing with anyone anywhere. Just upload your files from the Work profile to a free cloud service. That's it.
I found this thread while searching for a way to access Work files directly, using adb
. It all seems so complicated to do.
I tried Etienne's suggestion using snapdrop.net between Work and Regular profiles. It is OK but is limited to a single file at a time.
I then tried FX File Explorer and Total Commander but couldn't reproduce the results given by sanchez0x or on GitHub.
I then read on another thread a suggestion to install Google Drive in the Work profile and then upload and access files anywhere, not just on your device. There would be no restrictions in the Work profile on uploads to a server. I decided to transfer them to OneDrive since I already have an account and I can just use a browser (Firefox), even while using a VPN, to upload an entire directory of files and access them anywhere in the world and share them as well. I tried it with a directory of 99 files. I was able to download them to my Mac and delete them and empty the trash on OneDrive to free up limited (5GB) free space. It won't cost you a penny, or lots of time trying to 'game' adb
.