Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.