简体   繁体   中英

Using local shell and editor environment over ssh

I am working in a huge company with more than 500 servers. All of these servers are Linux based so they are using openssh. The client is also based on Linux. If I open a connection to the remote server I am getting a plain default BASH shell.

I would be really happy if there were a solution to forward my local client shell environment and editor configuration to the remote server to get my familiar working environment without copying everything.

Thank you

I can provide a very basic answer only.

This said, I suppose to make yourself familiar with the tool ansible .

It lets you stay on your local terminal/shell and send commands to multiple remotes easily, but, for example, environment variables will need to be defined with that commands.

Nevertheless, ansible also makes it easy to transfer eg a .bash_profile to many remotes.

If your login shell is bash, you can use process substitution to remotely use the local rc file.
You can not transfer files read by source using bashrc, so you need to specify them manually. Also, editor settings such as vim can be used on ssh destinations by creating another function and keeping the local settings there.

ssh -t user@host '
  bash --rcfile <(
    echo ' $(cat ~/.bashrc ~/.bash_function_etc... | base64 ) ' \
  | base64 -d)'

screenshot

In my case, I use this function in my own ssh client (lssh) .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM