Very newb-ish question, I'm writing a simple bash script on linux to execute a few commands that are helpful to me. I've got a linux book that's walking me through the individual commands and bash shell scripting. Previously I was using PuTTY to do this, but I'd rather streamline this process via the local terminal. Here's what I'm trying to accomplish:
1. Move a local file to a remote computer (rsync)
2. Remove a symbolic link file on the remote computer (ssh)
3. Re-create the symbolic link on the remote computer (ssh)
4. Restart a service on the remote computer (ssh)
The script is working right now (I have '&&' between each command), but I have to enter the root password four times (once per command) to get through the whole script. How can I execute this script while only having to enter the password once?
The script looks like this:
Thanks!
1. Move a local file to a remote computer (rsync)
2. Remove a symbolic link file on the remote computer (ssh)
3. Re-create the symbolic link on the remote computer (ssh)
4. Restart a service on the remote computer (ssh)
The script is working right now (I have '&&' between each command), but I have to enter the root password four times (once per command) to get through the whole script. How can I execute this script while only having to enter the password once?
The script looks like this:
Code:
rsync [location/file] root@192.168.180.153:/[location/file] && ssh root@192.168.180.153 rm [location/file] && ssh root@192.168.180.153 ln -s [location/file] [location/sym. link] && ssh root@192.168.180.153 'service [program] restart'
Thanks!