Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

I have a local machine that was sitting around & doing very little, so I decided to turn it into a NAS (Network Attached Storage) machine, with a 40GB disk for Ubuntu (13.10), a 160GB disk that's currently unused, and a 1TB drive that's hosting Movies and TV Shows I've converted from DVD recently.

I'd like to expand its functionality into hosting all the Music of the house (shared between my family members and myself), however I don't want to just disk quota everyone, as I know there's overlap in our music libraries.

Idealy, this is what I want to do:

[ ] Give everyone accounts, and give them FTP write access for '/mnt/1TB/Music/_Shared' (I know how to do this step easily).

[ ] Set up a (cron?) job so that when someone uploads a file to '/mnt/1TB/Music/_Shared', it makes a symbolic link in a folder '/mnt/1TB/Music/{USERNAME}' for each user.

How would I get Ubuntu to create a symbolic link back to a folder (with each person's username, which I've already created) when a file is uploaded to the shared (_Shared) pool?

For reference, I run this machine as a headless NAS, so I cannot accept GUI instructions. That said, I do have SSH access, FTP access (currently provided by vsftpd), and Webmin installed on the machine, so that I can do things more easily.

I am also using samba on this machine to provide the content (read-only) to everyone - I could just as easily allow people to write into a share for the _Shared music, if that would be easier to do for symbolic linking. While it would be easier for everyone to upload their music to the server, I am willing to sacrifice this (with only ftp being possible for uploading) to gain dynamic symbolic linking of everything uploaded.

I basically want a file to be uploaded. If it doesn't exist, it's stored in _Shared, and a symlink is created in the folder by the name of whoever uploaded it. If it already exists, and it's the same filesize, then it should be a prompt (as usual, to either overwrite or skip), and still create a symlink indifferent of the choice the user makes.

I have been using Ubuntu for about a year now, so I feel I have a decent grasp on it - I've just no idea where to begin such an idea, and trying to search for a similar thing hasn't proved successful yet.

share|improve this question
While what you're trying to accomplish may be technically possible using bash scripts and cron jobs, this seems overly complicated when there are Media Server apps (Plex, for example - there are several others) that offer shared music service. – douggro Dec 30 '13 at 9:53
Plex is proprietary; however I have worked with XBMC before, so I know what you mean. On that same note however, I'm not looking for a media server app - I am having no issue sharing my content over the network with samba; I'm only looking for a way to keep it organized (by simlink per whoever uploaded) for Music. I am aware that it is possible with scripts and cron jobs, but I'm not sure how to go about setting such a thing up with them. – k2trf Dec 30 '13 at 19:37
You might want to ask this over on StackOverflow as it really has more to do with bash and cron scripting and is not Ubuntu-specific. Better audience reach to the programming-types. – douggro Dec 30 '13 at 20:16

Your Answer


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

Browse other questions tagged or ask your own question.