I'm having trouble with a web application I'm writing: The web application, which runs as user nobody, needs to launch an inkscape process to manipulate some SVG files. Because this runs as user nobody, there is no home directory. What I am doing is creating a temporary directory under /tmp and trying to set that as the home directory via export HOME=/tmp/someUniqueId. I then set a few things in that "temporary" home directory, like a symlink .fonts to the folder for the font files to use.

I know this works for finding the ~/.fonts directory. But when I launch Inkscape, all I get is a message that Inkscape could not create the .inkscape directory:

Cannot create directory /.inkscape

Doesn't $HOME set the location of my home directory? Why is Inkscape still trying to access / as my home directory?

  • Well apparently, HOME wasn't set to what you've expected. How exactly do you launch the app? Btw, are you sure inkscape is the right tool for the job? What do you need to modify in an SVG file?
    – alex
    Jun 13, 2011 at 20:10
  • 1
    @alex: I'm sure HOME is being set correctly. Other apps respect it. bash respects it when I cd ~. What would you recommend for converting SVG 1.2 files to SVG 1.1, PDF, PNG, PostScript etc? Batick doesn't work. Must support <textFlow>s
    – Josh
    Jun 13, 2011 at 20:17
  • Did you try ImageMagick? I don't know for the different svg-formats, but it converts (convert) multiple graphic formats, and afaik PDF as well. Jun 13, 2011 at 20:25
  • Not sure about SVG 1.2 to 1.1, but the rest seems to be the job for Cairo (cairographics.org) You may need to cross-breed cairo and librsvg, however, to render the SVG file on a cairo surface (and the latter can be anything like PDF, PNG, PostScript, etc.)
    – alex
    Jun 13, 2011 at 20:25
  • @alex: I will check out Cairo, thanks! Inkscape's PDF support actually has some issues with Illustrator compatibility, so if Cairo can fix that, I can drop the SVG 1.2->1.1, which is the only part of Inkscape requiring an X server, which is what causes the issue I have here!
    – Josh
    Jun 13, 2011 at 20:36

2 Answers 2


Inkscape, being a GTK application, uses the GLib g_get_home_dir function to find the user's home directory. As documented in that link, g_get_home_dir does not consult $HOME, but rather /etc/passwd. You'd have to patch Inkscape to check $HOME first (as shown in that link).

  • That answers my question, thanks! I guess I need to run the command as a user who has their homedir set to /tmp or something.
    – Josh
    Jun 13, 2011 at 20:57
  • 3
    I'm sure g_get_home_dir uses nsswitch rather than simply checking /etc/passwd. (Same thing on personal computers, though.)
    – user1686
    Jun 13, 2011 at 21:53

Yes, the home directory of the current user should be whatever the environment variable HOME indicates. There is, of course, a global system setting: the entry in /etc/passwd, or more generally the home field in the user database. Applications are supposed to use that setting only to look up a user other than the current user, or if there are security applications (e.g. a setuid program). Otherwise $HOME should take precedence. If it doesn't, it's a bug in the application.

cjm's answer shows that Inkscape and other Gnome applications are buggy in this regard.

  • Can you include a link for more information, regarding your claim that it should be considered a bug for an application to use nsswitch//etc/passwd to determine the location of its owner's home directory (besides of the exceptions you enumerated)? It seems to me that you're right, but it's hard to think of all possible situations, so a source with more information, or "official" recommendations from something like the Open Group or GNU Project, might enhance your answer. Sep 2, 2012 at 20:31
  • @EliahKagan See for example POSIX: “Home directory: The directory specified by the HOME environment variable.” The HOME variable is guaranteed to be set at login time (but the user may override it). Sep 2, 2012 at 21:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.