Super User is a question and answer site for computer enthusiasts and power users. 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

My home directory's permissions allow only myself access to it. Is it possible to put a file inside my home directory with.. say.. full permissions, and create a symlink to it so other users can access that file alone inside my home folder? System is Ubuntu Karmic.

share|improve this question

It's possible, but not with symbolic links. It's called Hard links. Usage:

ln /home/you/the-file /some/public/folder/

A reference to the file "the-file" will be created in /some/public/folder/the-file.

Hard links points to the same inode (file, directory, ...). Symbolic links have their own inode, and will not work in chroots for example. Since hard links links to a inode instead of a path, it can only be used on the same filesystem.

Another way would be bind mounts. This will require root permissions for running the mount command and can only be used for directories. Usage:

sudo mount --bind /home/you/the-folder-to-be-shared/ /some/public/folder

/some/public/folder should be an existent folder. It does not have to be empty, although it's recommended because the contents will not be visible after mounting /home/you/the-folder-to-be-shared on /some/public/folder. If you decide to remove this shared folder from /some/public/folder, run:

sudo umount /some/public/folder
share|improve this answer
Bear in mind the hard link needs to be on the same file system as the linked file, which may or may not be an issue if you have your own /home filesystem – Sirex Jan 24 '11 at 15:54
Good point, added it. – Lekensteyn Jan 24 '11 at 15:56

An easier way is to make a dir in your home directory, set it to whatever permission for the users you want to read to do so, then set your home dir to 701 permission.

With directories the read permission is needed to list the contents, execute to enter (as in to traverse, as done in the /path/to/dir part of the ls), and write to create files (when together with execute).

ls /home/[user] -- permission denied
ls /home/[user]/[shared dir] -- allowed

Anyone know of a down side to this? Please comment.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .