Home folder in `root` and not in `home`... I'm confused!

I have an issue with my home folder and this are giving me some permission problems.

I've installed an application that tells me that I have no permission to save in /home/username/Desktop, but in fact my home is in /home/username/Área de Trabalho (Área de Trabalho = Desktop, but in Portuguese).

  • Accessing as sudo my home is shown in the below image (look at the folder icon).
    (Inside is the desktop folder.)

enter image description here

  • Accessing as regular user my home is shown in the below image.
    (Inside is the Área de Trabalho folder.)

enter image description here

Is this normal? Should I tell Ubuntu where my actual home folder is? What I have to do?

Thanx in advance!


Solution 1:

The first screenshot ("as sudo") is shown in icon view, and the second screenshot ("as regular user") is in detailed list view, but they are actually showing the same folder structure. There is no discrepancy. (tachyons's answer explains why different folders have the house icon on them.) The detailed list view is giving you a bit more information; in particular, the folder called /home is expanded to reveal its contents, including the p_sardinha subfolder.

Since the two views are equivalent, there's doesn't appear to be problem relating to how you are viewing your folder structure. Therefore we can break your question down into two parts:

  • Where is my home folder?
  • How can I solve a problem where an application tries to access my desktop folder, but fails because it names that folder in the wrong language?

Where is my home folder?

Every human user of an Ubuntu system has a home folder (which is also called a home directory, since folder and directory mean the same thing). If you had user accounts set up on your Ubuntu system for more than one person, each one of them would have a separate home folder.

There is a folder called /home. That is not your home folder. In fact, that is never anyone's home folder. Rather, /home is the folder that contains human users' home folders.

Your home folder is /home/p_sardinha, because your username is p_sardinha.

More generally, for a human user username, the user's home folder is /home/username.

  • On some systems, including yours, the folder called /home contains a subfolder lost+found. This is not anyone's home folder. Instead, this exists by default in the root folder of ext2/ext3/ext4 filesystems; it is used to keep files that are recovered while repairing the filesystem, and it is not necessary for you to know anything about it, in order to use your home folder.

  • Some user accounts exist that do not correspond to actual human users of your computer. They exist so that certain programs can run with special identities, abilities, and restrictions appropriate for the tasks they are designed to perform. Non-human users generally do not have their home directories in /home. For example, as tachyons mentioned, the root user, which is the user actually running commands you run with sudo and gksu/gksudo (unless you use the -u flag) has /root as its home directory.

One of the reasons the distinction between the folder called /home and your actual home folder (which is a subfolder of that) is sometimes confusing, is that Nautilus (Ubuntu's file browser) calls your actual home folder "Home." For example, this is the contents of my home folder, shown in Nautilus:

Nautilus window for home folder

The actual name of that folder (whose contents are shown), however, is /home/ek (since my username is ek). My desktop folder is called Desktop and located within my home folder, so its fully qualified path is /home/ek/Desktop.

How can I solve a problem where an application tries to access my desktop folder, but fails because it names that folder in the wrong language?

There might be an application-specific solution, but you haven't provided details about the circumstances under which the error occurs or what application it's happening in, so I cannot provide such a solution. Fortunately, I can provide a general solution.

Since folders are sometimes called something besides their real name (for example, your home folder is sometimes called Home even though its name is p_sardinha), first make sure that your desktop folder's name really is Área de Trabalho. It's easy to check this--just view the contents of your home folder (as I did, in the screenshot above), and make sure it's called that there. I believe you have already done this.

So the real full name of your desktop folder is /home/p_sardinha/Área de Trabalho. But at least one of your applications wants to access it at /home/p_sardinha/Desktop. Assuming there is not also a folder called /home/p_sardinha/Desktop (you should check to be sure), you should be able to solve the problem by creating a symbolic link called Desktop in your home folder, that points to Área de Trabalho (your actual desktop folder).

To create this symbolic link, open a Terminal window (Ctrl+Alt+T) and run these commands:

cd
ln -s 'Área de Trabalho' Desktop
  • The first command (cd, with nothing after it) makes sure the command-line you're using is "in" your home folder (that is, that it is using your home folder as its present working directory).
  • The second command (that starts with ln) actually creates the symbolic link.

That should solve the problem. However, your applications really should be internationalized sufficiently as not to assume your desktop folder is always called Desktop. Therefore, I recommend reporting a bug in the application in which the problem occurred, so the developers can make the application work as well for Portugese-speaking users as it does for English-speaking users.

Solution 2:

Yes it is normal

sudo command opens the nautilus in root mode, root's home is root itself

Solution 3:

Every different user has a different home directory.

They're all configured in the file /etc/passwd. You have to log out and back in after editing that file for the change to home folder to take effect. Unless you're an advanced user, I wouldn't recommend editing this file anyway, but I mentioned it in case you're curious to view it and know how it works.

The "root" user's home directly is set by default to /root whereas ordinary users' home directories are set by default to /home/*username*. There's usually no good reason to move a home directory.

When running a graphical program with root privileges using gksu/gksudo, your home directory will usually be reported as /root (this explains why). This is normal, and it's only because you're using root privileges (which you should rarely ever need to use once you've set everything up properly).