The bridge process runs as root, so your commands will run as root. In fact, root is the only username defined on the Yun (unless you manually defined additional users.)
You appear to be copying multiple files. Also, to make those files take effect, you need to process some additional commands to stop and start the network. Rather than do each as an individual runShellCommand() call, it will likely be easier, and definitely faster and more efficient, to put them in a script file on the Linux side, and then call that script file from a single Process object call.
An advantage to doing this is that you can SSH into the Linux command prompt and develop and test your script file by running it directly from the command line. Then, once it's working the way you want, you can call it from the sketch. That way, you already know the script is working, and if it doesn't work when called from the sketch you know that it's because of the way it's being called, and not the individual commands in the script. Using that kind of divide and conquer strategy should make the development and testing easier.
thank you. and thanks for your suggestion. it makes a lot of sense. i'll search around and try to figure out how to do that. from the bridge side, i may have to copy a "virgin" script file from the linux thumb drive folder to a linux folder and then run that script from the bridge side. the script file will copy network and wireless files that are unique to a household and then stop and restart the network, etc. hope that makes sense. not just to you, but to me!
rret:
from the bridge side, i may have to copy a "virgin" script file from the linux thumb drive folder to a linux folder and then run that script from the bridge side.
There's no need to copy it, you can run it directly from the storage device. For example, assuming your script is named setupNetwork, and it has the appropriate shebang in the front and is marked as executable:
// Set up and run the script to set network parameters
Process proc;
proc.begin("/mnt/sd/arduino/setupNetwork");
proc.run();
// Display any output from the script
if (proc.available())
{
Serial.print("setupNetwork output: ");
while (proc.available())
Serial.print((char)proc.read());
Serial.println();
}
The first few statements set up the process object and run it, just as it would be run from the SSH command line.
The rest of it echos any output from the script (perhaps error messages?) to the serial port.
Note that while that code compiles, I haven't tried running it. But it's a simplified version of code I have used, so it should work, but might need a little tweak or two.