I'm working with lots of remote machines via ssh. My need is to have a common .profile (or an alias for ssh or anything else) to use with all the ssh sessions, because changing it in every machine (which I should never re-login in) it is a really waste of time.
Is there the possibility?
I've read that I can set "PermitUserEnvironment" so that I can set my own "VAR=VALUE", but what about custom scripts? For example I'd like to execute something like "set -o vi"...
The right answer here is to have a copy of your .profile or .bashrc or whatever on each machine.
Just write a small shell script and scp such a file to each of the boxes in question. A three liner like
for i in list_of_machines do scp .profile $i: done
will do it for you.
You can get the list of machines out of a file using the shell $() notation like $(cat filename) or generate it programatically if it is really use.
Even better still, if these are virtual hosts or some other sort of cloud of machines that are being generated automatically, put the .profile into the account when the machine is created.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With