Composer: file_put_contents(./composer.json): failed to open stream: Permission denied
<p>I'm trying to install <a href="https://github.com/hirak/prestissimo" rel="noreferrer">Prestissimo</a> to an Ubuntu 16.04 server, but that leads to an error:</p>

<pre><code>$ composer global require "hirak/prestissimo:^0.3"
Changed current directory to /home/kramer65/.composer


  [ErrorException]
  file_put_contents(./composer.json): failed to open stream: Permission denied


require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--] [&lt;packages&gt;]...
</code></pre>

<p>I'm logged in as user <code>kramer65</code>, so I wouldn't know why it can't write to my home folder. My normal reaction to a <code>permission denied</code> is to use <code>sudo</code>, but composer then always says:</p>

<blockquote>
  <p>Do not run Composer as root/super user! See <a href="https://getcomposer.org/root" rel="noreferrer">https://getcomposer.org/root</a> for details</p>
</blockquote>

<p>Any idea how I can solve this?</p>