setting up Pi-Hole + PiVPN + read/write root access for adding youtube script Topic is solved

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
nebulousman
Posts: 6
Joined: Wed Feb 17, 2021 3:45 pm

setting up Pi-Hole + PiVPN + read/write root access for adding youtube script

Post by nebulousman »

I have DietPi with Pi-Hole (with Unbound) and PiVPN (Wireguard) on raspberry pi 1B. My router handles port forwarding & manages DHCP which assigns pi the static ip. Everything was working and stable until I learned about the script to block most youtube ads https://gitlab.com/grublets/youtube-updater-for-pi-hole .

I’d like to run this script as root in my Pi-hole and cron per the instructions but I'm having a hard time accomplishing the first step which is simply download the script to /usr/local/bin.

I tried file server ProFTPD & Samba which get me to specified directories (picture/music/..etc) and I can’t access others. With OpenSSH I can do SFTP/SCP but the switch to OpenSSH server breaks my access to the pi-hole admin interface and my internet access.

I’m new to this & I suspect I’m making a simple mistake somewhere. My goal is read/write ftp or ssh access to dietpi so I can transfer the script and run it. Once I have that working the plan is to add a cron entry for script updates.

Any advice would be appreciated.
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: setting up Pi-Hole + PiVPN + read/write root access for adding youtube script

Post by Joulinar »

Hi,

you simply can download the file directly to your DietPi device by doing dollowing

Code: Select all

wget https://gitlab.com/grublets/youtube-updater-for-pi-hole/-/raw/master/youtube.update.sh
I tried file server ProFTPD & Samba which get me to specified directories (picture/music/..etc) and I can’t access others.
This is correct and working as expected because /mnt/dietpi_userdata is defined as root directory for the file services. On our online docs, we describe how to change the destination directory for both FPT as well as Samba https://dietpi.com/docs/software/file_servers/#proftpd
With OpenSSH I can do SFTP/SCP
There is no need to fully switch to OpenSSH server. You can simple install OpenSSH client (ID 0) to get SFTP/SCP working. However, installation of OpenSSH Server should not break other services.

Another option is to simple copy/past the code. It's not a long script and you could do simple nano /usr/local/bin/youtube.update.sh and add content of the script https://gitlab.com/grublets/youtube-upd ... .update.sh
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
nebulousman
Posts: 6
Joined: Wed Feb 17, 2021 3:45 pm

Re: setting up Pi-Hole + PiVPN + read/write root access for adding youtube script

Post by nebulousman »

thanks for the help. I went with your last suggestion of simple copy/paste and created the script directly in cron.minutely so it would run every minute for constant updates as recommended by the script author. Dietpi+pihole+pivpn has brought new life to my old rpi. Thank you.
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: setting up Pi-Hole + PiVPN + read/write root access for adding youtube script

Post by Joulinar »

pls have a look if the script is executed correctly. usually there is no ending like .sh allowed. As well keep an eye on your system as restarting DNS every minute could overload it.
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
nebulousman
Posts: 6
Joined: Wed Feb 17, 2021 3:45 pm

Re: setting up Pi-Hole + PiVPN + read/write root access for adding youtube script

Post by nebulousman »

sorry that my question is so basic but how would I confirm? I'm guessing via log, if so where do I find that?
also how frequently would you recommend I run it? hourly? daily?
thanks again
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: setting up Pi-Hole + PiVPN + read/write root access for adding youtube script

Post by Joulinar »

If I understood the code correctly, a log file should be written to /var/log/pihole.log as well as blocked hosts are stored in /etc/hosts.youtube. Both files should be growing. As well you can check CRON log journalctl -u cron.service

not sure what is a good time frame as I don't have such a script running. I just have seen the comments on Git about such issues https://gitlab.com/grublets/youtube-upd ... e/-/issues
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
nebulousman
Posts: 6
Joined: Wed Feb 17, 2021 3:45 pm

Re: setting up Pi-Hole + PiVPN + read/write root access for adding youtube script

Post by nebulousman »

looks like the script is not running as /var/log/pihole.log and /etc/hosts.youtube are not growing and are both actually 0 bytes.
I did change minutely scripts to run every 5mins. I'll follow the script instructions again to be sure I didn't miss anything. Ads are being blocked so I'm happy just not youtube while I figure it out.
Thanks again
User avatar
Joulinar
Posts: 4502
Joined: Sat Nov 16, 2019 12:49 am

Re: setting up Pi-Hole + PiVPN + read/write root access for adding youtube script

Post by Joulinar »

can you share ls -la /etc/cron.minutely/
Pls let us know if a solution is working. This could help others if they hit by similar situation. Your DietPi Team
nebulousman
Posts: 6
Joined: Wed Feb 17, 2021 3:45 pm

Re: setting up Pi-Hole + PiVPN + read/write root access for adding youtube script

Post by nebulousman »

total 16
drwxr-xr-x 2 root root 4096 Feb 19 20:00 .
drwxr-xr-x 79 root root 4096 Feb 19 18:59 ..
-rw-r--r-- 1 root root 163 Jan 18 16:17 readme.txt
-rwxr-xr-x 1 root root 1434 Feb 18 17:18 youtube.update

I did take out the .sh
User avatar
MichaIng
Site Admin
Posts: 2914
Joined: Sat Nov 18, 2017 6:21 pm

Re: setting up Pi-Hole + PiVPN + read/write root access for adding youtube script

Post by MichaIng »

Please remove the dot from the file name. Cron (respectively run-parts) only executes files with pure alphanumerical/dash/underscore names: https://manpages.debian.org/buster/debi ... ESCRIPTION
Post Reply