Zzikzzik CICD_Permission Denied
๐ด Permission Denied(public key, password)
โ Reference
- Permission Denied(public key)
- PasswordAuthentication yes, SSH ์ฌ์์
- Permission Denied(public key, password)
- PermitRootLogin yes
- PasswordAuthentication yes
- UseLogin yes
- root์ ๋น๋ฐ๋ฒํธ ์ค์
- SSH ์ฌ์์
- SSH Permission denied (publickey,password)
cat ~/.ssh/id_rsa.pub > ~/.ssh/authorized_keys
~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
- https://stackoverflow.com/questions/44363537/gitlab-ci-ssh-permission-denied-publickey-password
โ CICD reference
โ Key setting reference
https://m.blog.naver.com/awspro/221964190924
โ๏ธ open .pem ํค ํ์ธํ๊ธฐ
- ํค ์๋ ์ฅ์๋ก ๊ฐ์ cat zzikzzikKey.pem
- ์ด๊ฒ ๋ฐ๋ก SSH_PRIVATE_KEY
โ๏ธ PRIVATE ํค ๋ชจ์, ์ ์ฅ ์์น
SSH_PRIVATE_KEY ๋
1
2
3
-----BEGIN RSA PRIVATE KEY-----
โฆ
-----END RSA PRIVATE KEY-----
์ด๋ ๊ฒ ์๊น
- repository secret in Project > Settings > Secrets and Variables > Actions ์ ์ ์ฅ
- Add a new secret with the name
SSH_PRIVATE_KEY
and paste the contents of your.pem
file or private SSH key
โ๏ธ PUBLIC ํค ๋ชจ์, ์ ์ฅ ์์น
- ๋ฐ๋ฉด public key๋
- ssh-rsa AAAAB3โฆ user@example.com
์ด๋ ๊ฒ ์๊น
GitHub user profile > SSH and GPG Keys
์ ์ ์ฅํด์ผ ํ๋ค.
public key๋ฅผ authorized_keys์ ์ ์ฅ
1
2
cat ~/.ssh/zzikzzik_key.pub >> ~/.ssh/authorized_keys
~/.ssh/authorized_keys
1
ls -l ~/.ssh/authorized_keys
authorized_keys๋ณผ ๊ถํ์ด ec2-user์๊ฒ ์๋ค๋ ์๋ฏธ
- catํด์
- ์์ public key ์ ์ฅ๋์ด ์๋๊ฒ ํ์ธ
โ๏ธ ๊ถํ ๋ถ์ฌ
1
2
3
4
chmod 600 ~/.ssh/zzikzzik_key
chmod 644 ~/.ssh/zzikzzik_key.pub
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
โ๏ธ
โ๏ธ
This post is licensed under CC BY 4.0 by the author.