Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

What is the easiest/quickest way to share files among different users?

I would like each user to have access to the same music and pictures directories. Creating symbolic links seems tedious as I would have to manually add them after I created each user.

Is there a way to automatically create links to these directories for each user?

share|improve this question
    
I presume you mean users on the same machine, right? –  Flimm Jan 10 '13 at 19:03
    
Yeah, that's right. –  Sheldon Jan 10 '13 at 19:04
add comment

1 Answer

up vote 7 down vote accepted

You could write use below mentioned shell script to create links for those directories for existing users and could use skel so that links are automatically created when new users are added.

#!/bin/bash

# GENERATES ALL THE USER HOMES
USERSHOMES="$(cat /etc/passwd | grep home | grep -v /bin/false | cut -d: -f6)"

# THIS IS THE LINK NAME
LINK="music-dir"

# LINK DIRECTORY TO ALL HOMES
for h in $USERSHOMES
do

   # WHERE YOU WANT TO COPY TO
   _dir="${h}/Desktop"
   if [ -d "$_dir" ]
   then
      ln -s "/media/music" "$_dir/$LINK"
   fi
done  

Tested on my system.

share|improve this answer
    
Just what I was looking for. Thank you. –  Sheldon Jan 10 '13 at 19:31
add comment

Your Answer

 
discard

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.