Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Past experience has taught me never to test out unfamiliar media players on my existing media library, lest nosy "convenience" functions automatically rearrange, re-tag, sloppily import into, or otherwise alter my carefully-curated data.

How can I expose my music to such a player in a read-only fashion?

share|improve this question
up vote 4 down vote accepted

I will show two methods that do not require to alter the files in the media library.

Accessing data from another user

Create a new (non administrative) user otheruser, add it to your group:

sudo gpasswd -a otheruser $USER

Modify your home to grant read and execute permissions for the group members (this is required if you have an encrypted home partition):

chmod g+rx $HOME

Then switch to otheruser, that should have now read access to all your data.

I should point out that, if you have an encrypted home partition, the other user could access your data as long as you are logged in. So you should login then switch user without loggin out from the first user.

Pretend to modify permissions

The package bindfs allow to mount a given directory with altered permissions, so the steps could be:

Install the package

sudo apt-get install bindfs

Create a mount point and assign it to your user

sudo mkdir /media/home-altered
sudo chown $USER:$USER /media/home-altered

Mount the real home to the mount point without write permissions:

sudo bindfs -p a-w $HOME /media/home-altered

Now, in /media/home-altered you will see your home directory with altered permissions, and accessing data through that path prevent to modify the data.


Almost the same effect of the second method can be obtained with a bind mount and a read-only remount:

sudo mkdir /media/$USER
sudo mount --bind /home/$USER /media/$USER
sudo mount -o remount,ro /media/$USER
share|improve this answer
I doubt that any one will be willing to logon as a different user just for trying/using a media player. – binW May 23 '11 at 14:40
@binW: it is for testing purposes, not a definitive solution. This is what ask the user, if I understand correctly. – enzotib May 23 '11 at 14:45
@binW: I added a second method that do not require to switch user. – enzotib May 23 '11 at 15:13
Thanks, a bind mount is just what I needed. I ended up using the kernel's built-in bind mounts: mount --bind olddir newdir && mount -o remount,ro newdir – ændrük May 24 '11 at 15:01

Ok this is far-fetched but I sometimes do this when I really want to preserve/protect a file as it is.

So would you bother setting all of your music files to immutable even temporarily? Even root can't edit when the immutable bit is enabled.

chattr +i FILENAME

Oh but sadly it's only limited to EXT file systems. And I totally relate to your predicament. One time I accidentally deleted 2/3s of my music files because I executed a command that purged everything that ended with .mp3.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.