title: PDFTK Cannot Create User Directory
body: <p>I am attempting to run pdftk as user www-data with the following command (as root):</p>
  
  <pre><code>sudo -u www-data /snap/bin/pdftk
  </code></pre>
  
  <p>But I am getting this error:</p>
  
  <blockquote>
    <p>cannot create user data directory: /var/www/snap/pdftk/9: Read-only
    file system</p>
  </blockquote>
  
  <p>(Ubuntu 18.04, PDFTK installed with SNAP).</p>
  
  <p>The /var/www/snap/pdftk and /var/www/snap/pdftk/9 directories have rw permissions for the www-data user:</p>
  
  <pre><code>drwxr-xr-x 3 www-data www-data 4096 Jan 23 15:44 ./
  drwxrwxrwx 4 root     root     4096 Jan 23 15:44 ../
  drwxrwxr-x 4 www-data www-data 4096 Jan 23 15:44 pdftk/
  
  drwxrwxr-x 4 www-data www-data 4096 Jan 23 15:44 ./
  drwxr-xr-x 3 www-data www-data 4096 Jan 23 15:44 ../
  drwxrwxr-x 2 www-data www-data 4096 Jan 23 15:44 9/
  drwxr-xr-x 2 www-data www-data 4096 Jan 23 15:44 common/
  lrwxrwxrwx 1 www-data www-data    1 Jan 23 15:44 current -&gt; 9/
  </code></pre>
  
  <p>I need to be able to run PDFTK as www-data user because I want to call PDFTK from a PHP script served by apache2, as in:</p>
  
  <pre><code>&lt;?php
  `/snap/bin/pdftk file1.pdf file2.pdf cat output file3.pdf`;
  </code></pre>
  
  <p>NOTE: the pdftk wrapper for PHP, mikehaertl/php-pdftk, doesn't seem to want to save files either.  I tried the ->saveAs() function but no file is generated, even when attempting to write to /tmp, which should have full write permissions.  No errors in apache2 error log, so I'm betting it's the same issue.</p>