d2c.sh
d2c.sh copied to clipboard
Error: open /etc/d2c/d2c.toml: permission denied
I installed, create /etc.d2c/d2c.toml accordingly. However when I run
"d2c.sh" or "sudo "d2c.sh", I'm facing this problem
Error: open /etc/d2c/d2c.toml: permission denied
Hi,
I understand you followed "Method 1" in the README?
- Install with
install.sh(Copiesd2c.shinto/usr/local/bin) - Create
etc/d2c/d2c.tomland fill your own configuration - Run
d2c.sh
I just tried the process and worked fine:
root@DRIES:~/temp/d2c.sh# ./install
Successfully installed d2c.sh into /usr/local/bin.
Please, run d2c.sh from command-line before scheduling any cronjob.
Help: `d2c.sh --help` or `d2c.sh -h` or `d2c.sh help`.
root@DRIES:~/temp/d2c.sh# d2c.sh
Error: 'yq' required and not found.
Please install: https://github.com/mikefarah/yq.
( ... install yq ... )
root@DRIES:~/temp/d2c.sh# d2c.sh
Directory: /etc/d2c/ does not exist.
Creating...
Created /etc/d2c/. Please, fill /etc/d2c/d2c.toml.
I tried. Maybe because of d2c.toml permission attribute?
-rw-r--r-- 1 root root 243 May 20 17:57 /etc/d2c/d2c.toml
What is your file permission attribute?
Hi! Sorry for the delay. First of all, I would like to thank you for giving a try to d2c.sh. Let's try to make it work for you!
My file permissions are the same as you:
root@DRIES:/etc/d2c# ls -la
total 12
drwxr-xr-x 2 root root 4096 May 20 08:24 .
drwxr-xr-x 81 root root 4096 May 20 08:24 ..
-rw-r--r-- 1 root root 148 May 20 08:24 d2c.toml
Are you able to edit d2c.toml using a text editor? Maybe sudo nano /etc/d2c/d2c.toml.
Plus, could you check file permissions for the actual executable?
Mine:
root@DRIES:/usr/local/bin# ls -la d2c.sh
-rwxr-xr-x 1 root root 3469 May 20 08:23 d2c.sh
Let me try in a different host to check I get the same error as you do.
Are you able to edit d2c.toml Yes
check file permissions for the actual executable? Same as yours.
I'll try to install and setup as root and give you feedback
Same even i install as su - root
However i edit d2c.sh
from
config_file_dir="/etc/d2c/"
to
config_file_dir=""
and put the dc2.toml in the same directory, it work.
Mmmm, that is very strange. I guess that for some reason that I don't understand, d2c.sh can't read the /etc/ directory. You can put d2c.toml wherever you want and it will work, I guess you can try the home directory for better organization, maybe
config_file_dir="$HOME/.d2c/"
Whatever you prefer!
For info, i'm using
- Ubuntu 22.04
- Install and config always using sudo
Suggestion, maybe you can add cronjob script run every 10 minutes in d2c.sh. It will help safe time.