> For the complete documentation index, see [llms.txt](https://alicenab.gitbook.io/linux/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://alicenab.gitbook.io/linux/redhat/redhat-administration-1-rh124/chapter-10.md).

# Chapter 10

CONFIGURING AND SECURING SSH

```
# creating private and public keys via ssh-keygen command:
ssh-keygen -f ~/.ssh/myKeysFolder
~/.ssh/id_rsa        # id_rsa
~/.ssh/id_rsa.pub    # id_rsa.pub

# transferrinjg public key to remote server
ssh-copy-id -i .ssh/key-with-pass.pub user@remotehost


# Şifrəli ssh private keylərin şifrələrini sistemdə müvəqqəti yadda saxlamaq üçün
eval $(ssh-agent)
ssh-add .ssh/key-with-pass
ssh -i .ssh/key2 operator1@servera hostname
```

## OpenSSH configuration

Əsas konfiqurasiya faylı:

```
/etc/ssh/ sshd_config
```

Konfiqurasiyalar:

```
# Root istifadəçisi sistemə ssh vasitəsilə girə bilmir
PermitRootLogin no                

# Root istifadəçisi sistemə yalnız ssh key vasitəsilə girə bilir
PermitRootLogin without-password  

# Heç bir istifadəçi sistemə ssh şifrəsi vasitəsilə girə bilmir
PasswordAuthentication no         # 
```

SSH konfiqurasiyasını reload etmək:

```
systemctl reload sshd
```
