Password Less Login To a Server & Managing multiple servers - Linux, Windows & Mac etc... #ssh #sshserver #openssh #opensshserver #password #servers #putty #linux #windows
https://www.codewithharry.com/blogpost/transferring-files-passwordless-login-ubuntu-20-04/
https://www.youtube.com/watch?v=pMJ0_pj5IJI&list=PLu0W_9lII9aiBNXUisDdSmfNbsKq407XC&index=8 - CodeWithHarry
# Passwordless login & Managing multiple servers
To connect to your server without a password from your Windows PC, you can use SSH key-based authentication. Here's a step-by-step guide to set it up:
### Step 1: Install an SSH Client (if not already installed)
- **Windows 10/11** comes with a built-in SSH client, so you don't need to install anything.
- If you're using an older version of Windows or prefer a GUI tool, you can use **PuTTY** or **MobaXterm**.
### Step 2: Generate an SSH Key Pair (on your Windows PC)
You need to create an SSH key pair (a public and a private key) on your Windows PC:
1. **Using the Command Prompt (Built-in SSH client)**
- Open the **Command Prompt** or **PowerShell**.
- Run the following command to generate the SSH key:
```bash
ssh-keygen
```
- Press **Enter** to accept the default location (C:\Users\<YourUserName>\.ssh\id_rsa).
- You can set a passphrase, but leave it empty if you want passwordless access.
2. **Using PuTTY (If you prefer)**
- Download and install **PuTTY** and **PuTTYgen** from the official website.
- Open **PuTTYgen** and click "Generate" to create a key pair.
- Save the private key (.ppk file) and copy the public key.
### Step 3: Copy the Public Key to the Server
Now, you'll need to copy the public key from your Windows PC to your server:
1. **Using PowerShell/Command Prompt (for built-in SSH client)**
- Use the `ssh-copy-id` command to copy the public key to your server:
```bash
ssh-copy-id username@your_server_ip
```
- If `ssh-copy-id` is not available, manually copy the key:
- On your Windows PC, open the `.ssh/id_rsa.pub` file and copy its contents.
- On your server, log in with your password and append the public key to the `.ssh/authorized_keys` file:
```bash
echo "your_public_key" >> ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
```
2. **Using PuTTY**
- In PuTTY, open an SSH session to your server using your username and password.
- On the server, create or open the `~/.ssh/authorized_keys` file.
- Paste your public key into this file and save.
### Step 4: Test the SSH Connection
- Now, try connecting to your server using SSH without a password:
```bash
ssh username@your_server_ip
```
- If you're using PuTTY, load the private key in PuTTY's SSH settings under "Auth."
If everything is set up correctly, you should be able to log in without being prompted for a password!
Comments
Post a Comment