LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Bash Environment Roaming Profile? (https://www.linuxquestions.org/questions/linux-server-73/bash-environment-roaming-profile-772959/)

loadedmind 12-02-2009 08:26 AM

Bash Environment Roaming Profile?
 
Hi all. Supposing I wanted the same bash profile environment regardless of which server I ssh into. Would it be possible to somehow pull a set of files from one [supposing we called it] "template" server (that has the set of files used regularly, containing my .bash_profile and other . files) onto each server automatically? All of these servers have my ssh key and I have an alias setup (on my Macbook Pro) to connect using a number, i.e. typing "1" connects me to server1.domain and so forth. They're passwordless key pairs because we're pretty confident our hardware firewall perimeter is solid. To take this a step further, for those servers I missed (scp'ing the ssh keys to in other words), would it be possible to automatically grab the necessary authorized_keys contents to them without prompting me for a password?

rweaver 12-02-2009 09:53 AM

You could simply scp the .bash* files ahead of your ssh connection for the first part of the question. The later part could be accomplished using a variety of methods none of them what I would consider safe in the long run because they end up storing a password in an unencrypted file.

loadedmind 12-04-2009 12:24 PM

Alright. I was afraid of that. Thanks for reviewing it anyway.

Loadedmind

jschiwal 12-04-2009 01:05 PM

Look in the ssh_config and sshd_config man pages. `SendEnv' in ssh_config on the client defines which environmental variables to send to the server when you log in. `AcceptEnv' in sshd_config defines which variables to accept. Pay attention to the warning about doing this in the man pages.

stevenworr 12-04-2009 03:41 PM

I think your question is flawed. You need to be more explicit about what you mean by environment, if you think the environment means more than the set of environment variables you define. I personally set all my environment variables in a way that allows each machine to be customized. It sort of helps that lats of env vars are all managed as colon separated lists. I use that fact to create flat files which are read by a common script to form the different values for each of the variables. Each flat file can be designed to be common across lots of machines with varying architectures. In the end, the values of the variables are stored on a basis that allows for slicing and dicing any way you like and only the data files are needed but the scripts are common.

loadedmind 01-13-2010 12:36 PM

stevenworr:
Is it possible for you to provide the env variables/files involved as an example and just mask the private info within them?

jschiwal:
Thank you for that information. I guess I hadn't realized ssh_config had that kind of power. I'll definitely check into it.

Thanks all!


All times are GMT -5. The time now is 10:47 AM.