https://github.com/feifeibear/ssh-passwd-free
Method to set passwd-free for a set of IPs
https://github.com/feifeibear/ssh-passwd-free
Last synced: 8 months ago
JSON representation
Method to set passwd-free for a set of IPs
- Host: GitHub
- URL: https://github.com/feifeibear/ssh-passwd-free
- Owner: feifeibear
- Created: 2023-05-02T08:45:13.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-02T08:59:31.000Z (about 3 years ago)
- Last Synced: 2025-04-15T21:16:02.230Z (about 1 year ago)
- Language: Shell
- Size: 1000 Bytes
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Setting up passwordless SSH for a series of machines
Assuming you have a personal computer and the IP addresses of several remote machines that your personal computer can access, the following steps will allow you to set up passwordless login for these machines. It is assumed that the local username is "you" and the remote username is "root".
Write the IP addresses of the remote machines, one per line, in a file named `ip_list.txt`.
## 1. Set up passwordless login between your personal computer and the remote machines
```
bash local_passwdless_login.sh
```
## 2. Modify SSH config
Since the local username "you" and the remote username "root" are different, you need to add the following configuration to your `~/.ssh/config` file, with a hostname for each IP address and set the login user to "root".
```
Host sv001
HostName remote_ip1
User root
Host sv002
HostName remote_ip2
User root
...
```
## 3. Set up passwordless login between the remote machines
You need to install Ansible first.
Edit the `hosts` file and add the hostnames as follows:
```
[sv]
sv001
sv002
```
Run the following command to set up passwordless login between all machines listed in `ip_list.txt`.
```
bash run.sh
```