Strange thing. I have a shellscript that needs to be run with sudo since it uses dumpcap.
#!/bin/bash
# Simulates the transmissions with Sirannon
mkdir -p 3dvideos_streamed
mkdir -p 3dvideos_packetcapture
for file in Alt_moabit Book_arrival Door_flowers Leaving_laptop
do
for qp in 10 15 25 32 45 60
do
echo "Now simulating transmission of $file with QP $qp ... "
echo "Starting dumpcap ... "
touch 3dvideos_packetcapture/$file-$qp.cap
dumpcap -i lo -f "udp port 5000" -a duration:15 -w 3dvideos_packetcapture/$file-$qp.cap &
cp 3dvideos_encoded/$file/qp$qp/test.264 3dvideos_streamed/$file-$qp-in.264 &
echo "Starting sirannon ... "
sirannon sirannon-0.6.8/dat/xml/mvc.xml 3dvideos_encoded/$file/qp$qp/test.264 3dvideos_streamed/$file-$qp 3dvideos_streamed/$file-$qp-out.264
echo "Sirannon is done streaming."
sleep 15
done
done
echo "Fixing permissions ... "
chmod -R 655 3dvideos_streamed
chmod -R 655 3dvideos_packetcapture
Now I’m left with this:
werner@savant:~/CACMTV$ ls -la 3dvideos_packetcapture/
ls: cannot access 3dvideos_packetcapture/Alt_moabit-60.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Book_arrival-60.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/..: Permission denied
ls: cannot access 3dvideos_packetcapture/Leaving_laptop-10.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Leaving_laptop-32.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Leaving_laptop-60.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Alt_moabit-25.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/.: Permission denied
ls: cannot access 3dvideos_packetcapture/Door_flowers-10.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Door_flowers-15.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Book_arrival-15.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Leaving_laptop-15.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Door_flowers-25.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Alt_moabit-10.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Door_flowers-32.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Leaving_laptop-25.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Book_arrival-45.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Alt_moabit-45.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Door_flowers-45.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Book_arrival-10.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Alt_moabit-15.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Door_flowers-60.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Leaving_laptop-45.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Alt_moabit-32.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Book_arrival-25.cap: Permission denied
ls: cannot access 3dvideos_packetcapture/Book_arrival-32.cap: Permission denied
total 0
d????????? ? ? ? ? ? .
d????????? ? ? ? ? ? ..
-????????? ? ? ? ? ? Alt_moabit-10.cap
-????????? ? ? ? ? ? Alt_moabit-15.cap
-????????? ? ? ? ? ? Alt_moabit-25.cap
-????????? ? ? ? ? ? Alt_moabit-32.cap
-????????? ? ? ? ? ? Alt_moabit-45.cap
-????????? ? ? ? ? ? Alt_moabit-60.cap
-????????? ? ? ? ? ? Book_arrival-10.cap
-????????? ? ? ? ? ? Book_arrival-15.cap
-????????? ? ? ? ? ? Book_arrival-25.cap
-????????? ? ? ? ? ? Book_arrival-32.cap
-????????? ? ? ? ? ? Book_arrival-45.cap
-????????? ? ? ? ? ? Book_arrival-60.cap
-????????? ? ? ? ? ? Door_flowers-10.cap
-????????? ? ? ? ? ? Door_flowers-15.cap
-????????? ? ? ? ? ? Door_flowers-25.cap
-????????? ? ? ? ? ? Door_flowers-32.cap
-????????? ? ? ? ? ? Door_flowers-45.cap
-????????? ? ? ? ? ? Door_flowers-60.cap
-????????? ? ? ? ? ? Leaving_laptop-10.cap
-????????? ? ? ? ? ? Leaving_laptop-15.cap
-????????? ? ? ? ? ? Leaving_laptop-25.cap
-????????? ? ? ? ? ? Leaving_laptop-32.cap
-????????? ? ? ? ? ? Leaving_laptop-45.cap
-????????? ? ? ? ? ? Leaving_laptop-60.cap
I can see the files in Nautilus, but I can’t open them:

How do I fix this – how would I need to change my shellscript in order for dumpcap to have the necessary permission but at the same time leave my permissions intact?
It turns out the easiest solution is to just run the command as:
Then all lines with
chmod/chownare not needed.