How can I give
mkdirpermissions to a script that is called by
sudo systemctl start <service-name>??
Here is the error being thrown in the results of
sudo journalctl -u jekyll -f when I type the
sudo systemctl start jekyll command:
Mar 20 18:29:52 long.host.name jekyll: /usr/share/ruby/fileutils.rb:239:in `mkdir': Permission denied @ dir_s_mkdir - /.jekyll-cache (Errno::EACCES)
I then opened
/usr/share/ruby/fileutils.rb and saw that the directories to be created were in the
/usr/local/lib/ruby path. Since
/usr/local/lib/ already existed, I typed the following two commands to remove all obstacles to anyone writing to these directories:
sudo chown -R jekyll-host:jekyll-host /usr/local/lib sudo chmod 777 /usr/local/lib
And then I also separately upgraded to root with
sudo su - and I ran the
systemctl start jekyll command as root, but even this resulted in the same permissions error shown above.
The line in the
jekyll.service file that attempts to start this server but throws the above error is:
ExecStart=/bin/sh -c '/usr/local/bin/jekyll s --trace'
As you can surmise, the
/usr/local/bin/jekyll program called in the
ExecStart command in turn calls other scripts including the
/usr/share/ruby/fileutils.rb script shown above which does not seem to have permissions to create a directory.
This is running on an EC2 instance with Amazon Linux 2, which of course is an extension of RHEL.
What specific syntax needs to be changed in order to adequate permissions to be propagated throughout the chain of programs that are called when this
sudo systemctl start jekyllcommand is run?