secure shell connection For connecting via public key - Generate a private key for authentication - `ssh-keygen -t rsa -b 4096 -C "email"` - Transfer the public key to the server - `ssh-copy-id user@server_ip` - On the server - `sudo apt-get install openssh-server` # For Debian/Ubuntu - `sudo systemctl enable ssh` - `sudo systemctl start ssh` - Configure sshd - `sudo nano /etc/ssh/sshd_config` ``` PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys ``` - `chmod 700 ~/.ssh` - `chmod 600 ~/.ssh/authorized_keys` - Port 22 `ssh-agent` is a program for managing private keys, allowing secure storage of keys in memory and using them for authentication without needing to re-enter passwords or passphrases. The `ssh-agent` keeps your private keys in RAM, safeguarding them from being stored on disk in plaintext. You only need to enter the password once to load the private key into the agent. After that, you can use the key to connect to multiple servers without re-entering the password. **Integration with SSH Client:** - The SSH client can automatically interact with `ssh-agent` to obtain keys and perform authentication. Start `ssh-agent` in a new shell. This will create a new agent process and generate the necessary environment variables. ```bash eval "$(ssh-agent -s)" ``` Use the `ssh-add` command to add your private key to the agent. ```bash ssh-add ~/.ssh/id_rsa ``` - You can view the list of keys stored in `ssh-agent` with the command: ```bash ssh-add -l ```