5

Can the /home folder contain anything else but user folders? I have a folder I want to share between Windows and Arch - can it go in the home folder under a name not belonging to any existing user?

E.g.

/home
  |-/james (my home folder)
  |-/shared (folder I want to share)
James N
  • 153
  • Keep in mind that it is probably the default place for your homedirs, so when you would want to create a new account called 'shared', it's default homedir-location would be taken allready. This is not a problem per se, but true nonetheless. – Nanne May 27 '14 at 10:22
  • 1
    If you're going to have shared non-user content, use /srv/. This separates user settings from files. It makes backing up and recovery less confusing. –  May 26 '14 at 21:57

2 Answers2

13

I assume you're using a Linux system, but it shouldn't make any difference anyway. You can have anything you like in /home, there is no restriction. It is simply the standard place where user home directories are kept but many systems have them in different locations. OSX, for example, uses /Users instead.

In any case, even within the Linux world, /home is optional. As explained in the filesystem hierarchy standard there is basically no restriction and not even a requirement for /home to exist:

3.8. /home : User home directories (optional)

3.8.1. Purpose

/home is a fairly standard concept, but it is clearly a site-specific filesystem. The setup will differ from host to host. Therefore, no program should rely on this location.

3.8.2. Requirements

User specific configuration files for applications are stored in the user's home directory in a file that starts with the '.' character (a "dot file"). If an application needs to create more than one dot file then they should be placed in a subdirectory with a name starting with a '.' character, (a "dot directory"). In this case the configuration files should not start with the '.' character.

3.8.3. References

A number of efforts have been made to standardize the layout of home directories, including the XDG Base Directories specification and the GLib conventions on user directory contents. To accommodate software which makes use of these conventions, distributions may create directory hierarchies underneath home directories which conform to them.

In summary, /home is just a convention and no system that follows the FHS requires it or has any expectations of it. There is no problem including directories in /home that are not user $HOME dirs. For example, on many systems, /home is a separate partition and, therefore, running fsck on it will create the /home/lost+found directory which is not connected to any user.

terdon
  • 242,166
  • Thanks for the info - yes it is Linux. I ask this because I wanted to mount my second HDD as /home, and it contains folders other than my W7 user folder. – James N May 26 '14 at 17:21
  • 3
    @JamesN: If the other HD is formatted for use by windows, the problem is not going to be what it contains, but the fact that it's unsuitable for many uses that applications might expect to work. For instance, lacking symlink and hardlink support, case-sensitive filenames, fifos, unix sockets, ... – R.. GitHub STOP HELPING ICE May 26 '14 at 19:35
  • 1
    +1 for mentioning lost+found – Dubu May 27 '14 at 05:38
  • @R It's formatted in ntfs, and the symlinks set up seem to be functioning - have I missed something? – James N May 27 '14 at 11:36
  • A quick question, since no program should rely on it's location, how do programs decide to place the dotfiles to the home directory? – OganM Nov 28 '14 at 19:26
  • @OganM By using the ~ shorthand or the $HOME environment variable. Most users will have these available. But in the case of no home directory, most programs default to /etc as a backup when they can't find a home directory. E.g. if ~/.vimrc doesn't exist, then vim will look for /etc/vimrc or /etc/vim/vimrc – Braden Best Mar 03 '15 at 21:45
0

For years on Windows I used a directory called "data" to put all my docs/music/photos and everything else that I created into. I am so glad I did because as I moved from one machine to the next I simply moved that single directory and re-installed whatever I needed.

A few years ago I moved to Linux and lamented the loss of this single data directory, though my user directory in home was close. Then because I program for Windows quite a lot and really wanted to have that directory structure again I mapped a separate partition that is NTFS to /home/data and have been glad ever since.

I have moved house to a new PC several times and have that same great experience of it all just being right there and have very few repercussions for it. The main thing I lack is that there is no "executable" bit in files presented in Linux so programs/scripts that I save when booted to windows sometimes have to be moved to another location when I want to run them in Linux because NTFS lacks that bit. Which has been fine for me since I never wanted "programs" there anyway.

slm
  • 369,824
Danny
  • 1
  • There's no reason /home/data would have to be NTFS, you can just make it. And it could even be in your home directory, e.g. /home/dan/data. – Kevin May 28 '14 at 01:42
  • it is NTFS so it can be shared easily in the Windows OS run time. – Danny May 28 '14 at 02:01
  • @Kevin He mounted a separate NTFS partition to /home/data/ for the same reason one would mount an NTFS partition on a Linux box in general: so that both Linux and Windows can access it. And since Windows, unsurprisingly, does not have native support for ext4 filesystems, he had to compromise for NTFS, which Linux does support. – Braden Best Mar 03 '15 at 21:53