diff options
| author | hc <hc@email.ch> | 2024-10-02 11:15:50 +0800 |
|---|---|---|
| committer | hc <hc@email.ch> | 2024-10-02 11:15:50 +0800 |
| commit | 58f75cd799cefa86a378a78599710de0099cb86a (patch) | |
| tree | 42e11c53acb2e1414efe5e6a64380ef589f31dea | |
| parent | 809a9229b68f4b1385915c152a49e69ebee963a7 (diff) | |
added ssh agrent forwarding
| -rw-r--r-- | .git.sh.swp (renamed from .setup.sh.swp) | bin | 12288 -> 12288 bytes | |||
| -rwxr-xr-x | git/set-global_git-ssh-wrapper.sh | 33 | ||||
| -rwxr-xr-x | git/set-global_user.sh | 2 | ||||
| -rwxr-xr-x | git/tools/git-ssh-wrapper.sh | 2 | ||||
| -rw-r--r-- | others/openstack_config.txt (renamed from openstack_config.txt) | 0 | ||||
| -rwxr-xr-x | others/reset-ssh-connections.sh (renamed from reset-ssh-connections.sh) | 0 | ||||
| -rw-r--r-- | others/setup_2_openstackenv.sh (renamed from setup_2_openstackenv.sh) | 0 | ||||
| -rw-r--r-- | others/vm.sh (renamed from vm.sh) | 0 | ||||
| -rwxr-xr-x | setup.sh | 4 |
9 files changed, 41 insertions, 0 deletions
diff --git a/.setup.sh.swp b/.git.sh.swp index 6e4693c..612ed8e 100644 --- a/.setup.sh.swp +++ b/.git.sh.swp | |||
| Binary files differ | |||
diff --git a/git/set-global_git-ssh-wrapper.sh b/git/set-global_git-ssh-wrapper.sh new file mode 100755 index 0000000..e851f1b --- /dev/null +++ b/git/set-global_git-ssh-wrapper.sh | |||
| @@ -0,0 +1,33 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | if ! sudo grep -q "^AllowAgentForwarding yes" /etc/ssh/sshd_config; then | ||
| 4 | echo "AllowAgentForwarding not set. Adding it to sshd_config..." | ||
| 5 | echo "AllowAgentForwarding yes" | sudo tee -a /etc/ssh/sshd_config > /dev/null | ||
| 6 | echo "Added AllowAgentForwarding yes to /etc/ssh/sshd_config" | ||
| 7 | else | ||
| 8 | echo "AllowAgentForwarding is already set to yes in /etc/ssh/sshd_config" | ||
| 9 | fi | ||
| 10 | # this should be enabled on both client and server | ||
| 11 | |||
| 12 | # Get the directory of this script | ||
| 13 | SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
| 14 | |||
| 15 | # Path to the git-ssh-wrapper.sh | ||
| 16 | WRAPPER_PATH="$SCRIPT_DIR/tools/git-ssh-wrapper.sh" | ||
| 17 | |||
| 18 | # Check if the wrapper script exists | ||
| 19 | if [ ! -f "$WRAPPER_PATH" ]; then | ||
| 20 | echo "Error: git-ssh-wrapper.sh not found at $WRAPPER_PATH" | ||
| 21 | exit 1 | ||
| 22 | fi | ||
| 23 | |||
| 24 | # Make sure the wrapper script is executable | ||
| 25 | chmod +x "$WRAPPER_PATH" | ||
| 26 | |||
| 27 | # Set the global Git SSH command | ||
| 28 | git config --global core.sshCommand "$WRAPPER_PATH" | ||
| 29 | |||
| 30 | echo "Git SSH command has been set to use $WRAPPER_PATH" | ||
| 31 | echo "You can verify this by running: git config --global --get core.sshCommand" | ||
| 32 | |||
| 33 | #ssh-agent bash -c 'ssh-add ~/key && ssh -A -p24 user@code.server' | ||
diff --git a/git/set-global_user.sh b/git/set-global_user.sh new file mode 100755 index 0000000..30e11eb --- /dev/null +++ b/git/set-global_user.sh | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | git config --global user.email "hc@email.ch" | ||
| 2 | git config --global user.name "hc" | ||
diff --git a/git/tools/git-ssh-wrapper.sh b/git/tools/git-ssh-wrapper.sh new file mode 100755 index 0000000..dc23334 --- /dev/null +++ b/git/tools/git-ssh-wrapper.sh | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | ssh -v -A -o ForwardAgent=yes "$@" | ||
diff --git a/openstack_config.txt b/others/openstack_config.txt index 5e991a6..5e991a6 100644 --- a/openstack_config.txt +++ b/others/openstack_config.txt | |||
diff --git a/reset-ssh-connections.sh b/others/reset-ssh-connections.sh index f19300d..f19300d 100755 --- a/reset-ssh-connections.sh +++ b/others/reset-ssh-connections.sh | |||
diff --git a/setup_2_openstackenv.sh b/others/setup_2_openstackenv.sh index e56b66f..e56b66f 100644 --- a/setup_2_openstackenv.sh +++ b/others/setup_2_openstackenv.sh | |||
| @@ -37,6 +37,10 @@ set shiftwidth=2 | |||
| 37 | set softtabstop=2 | 37 | set softtabstop=2 |
| 38 | set tabstop=2 | 38 | set tabstop=2 |
| 39 | syntax on | 39 | syntax on |
| 40 | |||
| 41 | set laststatus=2 " permanent status bar | ||
| 42 | set statusline=%F " shows full file path | ||
| 43 | |||
| 40 | EOF | 44 | EOF |
| 41 | 45 | ||
| 42 | # add check fro each component | 46 | # add check fro each component |
