Skip to Main Content

Remote connection related records

Sign in without password -- ssh key

Open your git-bash, enter ssh-keygen, then enter three empty vehicles when typing.

Then execute ssh-copy-id<Username>@<HostIP>

Finally use ssh to try connecting, Wow, yourself, and connect directly!

The ssh-keygen command needs to be allowed only once, ssh-copy-id <username>@<hostIP> is used multiple times


It is recommended to use the ed25519 algorithm to generate a key that is safer and better than traditional RSA and better able to produce:

# Generate the ed25519 key to the prime minister
ssh-keygen -t 25519-C "your_email@example.com" -f ~/. Sh/id_ed25519-N ""

# Advantage:Super Super
# Key length shorter (only 68 characters) SIGHT
# Higher encryption SILE
# Generating and validating faster
ssh-keygen -t rsa -b 4096 -C "Your email address"

# parameter description:
# -t rsa:specifies the key algorithm as RSA (most compatible, recommended default);
# -b 4096:Key length 4096 bits (security is higher than the default 2048 bit);
# -C "mail":Note the key (easy to distinguish multiple keys, usually with email or usage).

Key management

It does not seem useful anything, no matter what

# Configure auto-launch of S
echo 'eval $(ssh-agent -s)>> ~/.zshrc
echo 'ssh-add ~/.ssh/id_ed25519_iu 2>/dev/null' >> ~/. sharc
echo 'eval $(ssh-agent -s)' >> ~/.bashrc
echo 'ssh-add ~/.ssh/id_ed25519_iu 2>/dev/null' >> ~/.bashrc

# SSH代理自动配置​
if ! pgrep -u "$USER" ssh-agent > /dev/null; then​
  ssh-agent -t 86400 > "$XDG_RUNTIME_DIR/ssh-agent.env"fi​
if [[ ! -z "$SSH_AUTH_SOCK" && ! -S "$SSH_AUTH_SOCK" ]]; then​
  source "$XDG_RUNTIME_DIR/ssh-agent.env" >/dev/null​
fi