Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

g #4

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

g #4

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions Day-02/01-passwordless-authentication.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,50 @@ ssh-copy-id -f "-o IdentityFile <PATH TO PEM FILE>" ubuntu@<INSTANCE-PUBLIC-IP>
- Update `PasswordAuthentication yes`
- Restart SSH -> `sudo systemctl restart ssh`




how to create the sshd.
The error "zsh: no matches found: /Users/akhilreddyannapureddy/.ssh/id_*" suggests that there are no files matching the pattern `/Users/akhilreddyannapureddy/.ssh/id_*` in your `.ssh` directory. This likely means you do not have any SSH keys generated yet.

Let's generate a new SSH key pair and then copy it to your remote server:

### 1. Generate a New SSH Key Pair
Run the following command to generate a new SSH key pair. You can use RSA or Ed25519. Here is an example using RSA:
```sh
ssh-keygen -t rsa -b 4096 -C "[email protected]"
```
Replace `"[email protected]"` with your email address. This command will prompt you for a file location to save the key (default is `~/.ssh/id_rsa`) and an optional passphrase.

### 2. Add the SSH Key to the SSH Agent
After generating the key, add it to the SSH agent:
```sh
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
```
If you used a different name or location for your key, adjust the path accordingly.

### 3. Copy the SSH Key to the Remote Server
Use `ssh-copy-id` to copy your SSH key to the remote server:
```sh
ssh-copy-id user@remote_host
```
Replace `user` with your remote username and `remote_host` with the remote server's address.

### 4. Verify the SSH Connection
Finally, test the SSH connection to ensure key-based authentication works:
```sh
ssh user@remote_host
```

### Additional Notes
- Ensure the `.ssh` directory and the key files have the correct permissions. For example:
```sh
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
```
- If you encounter any issues, make sure your SSH configuration in `~/.ssh/config` (if it exists) is correct and that the remote server is configured to accept key-based authentication.

By following these steps, you should be able to generate a new SSH key pair, add it to the SSH agent, and copy it to your remote server, resolving the initial issue.

27 changes: 27 additions & 0 deletions Day-03/01-yaml-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,30 @@ family:
- name: Jenny
age: 20
```



### playbook to create the directory and the files in the host system.
```
---
- name: Create directory and file
hosts: all
become: true
tasks:
- name: Create directory named foo
file:
path: /path/to/foo
state: directory
mode: '0755'
owner: root
group: root

- name: Create file named akhil inside foo directory
file:
path: /path/to/foo/akhil
state: touch
mode: '0644'
owner: root
group: root
ansible-playbook -i inventory.ini second-playbook.yaml
```
7 changes: 6 additions & 1 deletion Day-04/01-roles.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,4 +85,9 @@ of the infrastructure independently.

### Consistency
Using roles ensures that the same setup and configuration procedures are applied uniformly across
multiple environments, reducing the risk of configuration drift.
multiple environments, reducing the risk of configuration drift.



### to create the role in the ansible we need to use the below command.
ansible-galaxy role init test1