2

I run command:

find /var/www/html/wp-content/uploads/2015/file.jpg | xargs /usr/local/bin/jpegoptim --max=90 --all-progressive --strip-all --strip-com --strip-exif -- strip-iptc --strip-icc

and then i have to:

sudo chown -R www-data:www-data /var/www/html/

To change back the ownership. How can I run the original command without changing file attributes?

Thanks,

3
  • I think sudo username does the part about running as another user, but I'm not completely sure. Sep 24, 2015 at 0:57
  • Thanks Zacharee1 sudo -u www-data command worked for me :) Sep 24, 2015 at 1:04
  • Should I post it as an answer? Sep 24, 2015 at 1:07

1 Answer 1

5

Putting sudo -u username before your command will solve your problem.

1
  • 4
    I think it was sudo -u username, yes? just putting sudo somecommand produces "somecommand not found"
    – jmort253
    Mar 9, 2018 at 13:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .