๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ’ป/Azure

Azure ๊ฐ€์ƒ๋จธ์‹  ๋ฆฌ๋ˆ…์Šค SSH

๋ฐ˜์‘ํ˜•

 

https://docs.microsoft.com/ko-kr/azure/virtual-machines/linux/quick-create-portal

 

๋น ๋ฅธ ์‹œ์ž‘ - Azure Portal์—์„œ Linux VM ๋งŒ๋“ค๊ธฐ - Azure Virtual Machines

์ด ๋น ๋ฅธ ์‹œ์ž‘์—์„œ๋Š” Azure Portal์„ ์‚ฌ์šฉํ•˜์—ฌ Linux ๊ฐ€์ƒ ๋จธ์‹ ์„ ๋งŒ๋“œ๋Š” ๋ฐฉ๋ฒ•์„ ๋ฐฐ์›๋‹ˆ๋‹ค.

docs.microsoft.com

 

์—ฐ์Šต - SSH์— ๋Œ€ํ•œ ์ธ์ฆ ๋ฐฉ๋ฒ• ๊ฒฐ์ •

https://docs.microsoft.com/ko-kr/learn/modules/create-linux-virtual-machine-in-azure/3-exercise-generate-ssh-key

 

์—ฐ์Šต - SSH์— ๋Œ€ํ•œ ์ธ์ฆ ๋ฐฉ๋ฒ• ๊ฒฐ์ • - Learn

SSH์— ๋Œ€ํ•œ ์ธ์ฆ ๋ฐฉ๋ฒ• ๊ฒฐ์ •

docs.microsoft.com

 

Cloud Shell์—์„œ ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•ฉ๋‹ˆ๋‹ค.

ssh-keygen -m PEM -t rsa -b 4096

 

  1. Enter ํ‚ค๋ฅผ ๋ˆŒ๋Ÿฌ ๊ธฐ๋ณธ ์œ„์น˜๋ฅผ ์ ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ด ๋ช…๋ น์€ id_rsa ๋ฐ id_rsa.pub์ด๋ผ๋Š” ๋‘ ๊ฐœ์˜ ํŒŒ์ผ์„ ~/.ssh ๋””๋ ‰ํ„ฐ๋ฆฌ์— ๋งŒ๋“ญ๋‹ˆ๋‹ค. ํŒŒ์ผ์ด ์žˆ์œผ๋ฉด ๋ฎ์–ด์”๋‹ˆ๋‹ค.
  2. ์•”ํ˜ธ๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ๊ธฐ์–ตํ•ด๋‘ก๋‹ˆ๋‹ค. SSH ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ VM์— ์•ก์„ธ์Šคํ•˜๋Š” ๊ฒฝ์šฐ ์ด ์•”ํ˜ธ๊ฐ€ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

 

์˜ˆ๋ฅผ ๋“ค์–ด azureuser๋ผ๋Š” ์‚ฌ์šฉ์ž๋ฅผ ํฌํ•จํ•œ myserver๋ผ๋Š” Linux VM์ด ์žˆ๋Š” ๊ฒฝ์šฐ ๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ ํผ๋ธ”๋ฆญ ํ‚ค ํŒŒ์ผ์„ ์„ค์น˜ํ•˜๊ณ  ํ‚ค๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž์—๊ฒŒ ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

ssh-copy-id -i ~/.ssh/id_rsa.pub azureuser@myserver

 

Azure Linux VM์—์„œ SSH ํ‚ค ์Œ ์‚ฌ์šฉ

ํ‚ค ์Œ์ด ์ƒ์„ฑ๋œ ํ›„ Azure์˜ Linux VM์—์„œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. VM์„ ์ƒ์„ฑํ•˜๋Š” ๋™์•ˆ ๊ณต๊ฐœ ํ‚ค๋ฅผ ์ œ๊ณตํ•˜๊ฑฐ๋‚˜ VM์„ ๋งŒ๋“  ํ›„์— ๊ณต๊ฐœ ํ‚ค๋ฅผ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋‹ค์Œ ๋ช…๋ น์„ ์‹คํ–‰ํ•˜์—ฌ Cloud Shell์—์„œ ํŒŒ์ผ์˜ ์ฝ˜ํ…์ธ ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

cat ~/.ssh/id_rsa.pub

๋‹ค์Œ ์ถœ๋ ฅ๊ณผ ๊ฐ™์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

 

๋ณต์‚ฌํ•ด์„œ ํฌํ„ธ - ์—ฐ๊ฒฐ - SSH -  Replace/reset your SSH private key. ๊ณต๊ฐœ ํ‚ค ์žฌ์„ค์ •์— ๋ถ™์—ฌ๋„ฃ๊ณ  ์•”ํ˜ธ ์žฌ์„ค์ •๋„ ํ–ˆ์Œ

 

 

https://docs.microsoft.com/ko-kr/learn/modules/create-linux-virtual-machine-in-azure/6-exercise-connect-to-a-linux-vm-using-ssh

 

์—ฐ์Šต - SSH๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Linux ๊ฐ€์ƒ ๋จธ์‹ ์— ์—ฐ๊ฒฐ - Learn

SSH๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Linux ๊ฐ€์ƒ ๋จธ์‹ ์— ์—ฐ๊ฒฐ

docs.microsoft.com

 

root ๋น„๋ฐ€๋ฒˆํ˜ธ ์„ค์ •ํ•˜๊ธฐ

sudo passwd root

 

์š”์ฆ˜๋‚˜์˜ค๋Š” ๋Œ€๋ถ€๋ถ„ ๋ฐฐํฌํŒ์˜ linux๊ฐ€ root ๊ณ„์ •์€ ์ดˆ๊ธฐ ๋น„ํ™œ์„ฑํ™”๋˜์–ด ์žˆ๊ณ ,

์ดˆ๊ธฐ ๋“ฑ๋ก ์ผ๋ฐ˜ ๊ณ„์ •์—์„œ sudo ๋ช…๋ น์œผ๋กœ root ์•”ํ˜ธ๋ฅผ ์„ค์ •ํ•ด์„œ ์‚ฌ์šฉํ•ด์•ผํ•จ

 

SSH ๋น„๋ฐ€๋ฒˆํ˜ธ ๋กœ๊ทธ์ธ ์ฐจ๋‹จํ•˜๊ธฐ

 sudo vi /etc/ssh/sshd_config

PasswordAuthentication ์„ no ๋กœ ๋ณ€๊ฒฝํ•˜๋ฉด ํŒจ์Šค์›Œ๋“œ ์ ‘๊ทผ์„ ์ฐจ๋‹จํ•ฉ๋‹ˆ๋‹ค.

 

 

https://shanepark.tistory.com/255

 

Linux) SSH ๋น„๋ฐ€๋ฒˆํ˜ธ ๋กœ๊ทธ์ธ ์ฐจ๋‹จํ•˜๊ธฐ

ํ•œ์ฐฝ ์ž‘์—…์„ ํ•˜๋‹ค๊ฐ€ ๋ฌธ๋“ ์ œ๊ฐ€ ์ง‘์—์„œ ๋Œ๋ฆฌ๊ณ  ์žˆ๋Š” ์ปดํ“จํ„ฐ์— ์–ผ๋งˆ๋‚˜ ์ž์ฃผ ์ ‘์†์„ ํ•˜๊ณ  ์žˆ๋Š”์ง€ ๊ถ๊ธˆํ•ด์กŒ์Šต๋‹ˆ๋‹ค. ํ˜ผ์ž ์‚ฌ์šฉํ•˜๋Š” ์„œ๋ฒ„์ธ๋ฐ๋„ ์ข…์ข… ๋„ˆ๋ฌด ๋Š๋ ค์ง€๋Š”๊ฒƒ๋„ ์ด์ƒํ•˜๊ณ  ํ•ด์„œ ๋ณ„ ์ƒ๊ฐ ์—†์ด

shanepark.tistory.com

 

 

ssh ์„œ๋ฒ„ ์žฌ์‹œ์ž‘

 sudo service ssh restart

 

 

 

 

https://velog.io/@lehdqlsl/SSH-%EA%B3%B5%EA%B0%9C%ED%82%A4-%EC%95%94%ED%98%B8%ED%99%94-%EB%B0%A9%EC%8B%9D-%EC%A0%91%EC%86%8D-%EC%9B%90%EB%A6%AC-i7rrv4de

 

SSH ๊ณต๊ฐœํ‚ค ์ธ์ฆ์„ ์‚ฌ์šฉํ•˜์—ฌ ์ ‘์†ํ•˜๊ธฐ

๊ณต๊ฐœ ํ‚ค ์•”ํ˜ธ ๋ฐฉ์‹์€ ์•”ํ˜ธ ๋ฐฉ์‹์˜ ํ•œ ์ข…๋ฅ˜๋กœ ์‚ฌ์ „์— ๋น„๋ฐ€ ํ‚ค๋ฅผ ๋‚˜๋ˆ ๊ฐ€์ง€์ง€ ์•Š์€ ์‚ฌ์šฉ์ž๋“ค์ด ์•ˆ์ „ํ•˜๊ฒŒ ํ†ต์‹ ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•œ๋‹ค.๊ณต๊ฐœ ํ‚ค ์•”ํ˜ธ ๋ฐฉ์‹์—์„œ๋Š” ๊ณต๊ฐœ ํ‚ค์™€ ๋น„๋ฐ€ ํ‚ค๊ฐ€ ์กด์žฌํ•˜๋ฉฐ, ๊ณต๊ฐœ ํ‚ค๋Š”

velog.io

 

 

https://velog.io/@peter0618/SSH-Key-%EC%83%9D%EC%84%B1-%EB%B0%8F-%EC%A0%91%EC%86%8D-%EC%84%A4%EC%A0%95

 

SSH Key ์ƒ์„ฑ ๋ฐ ์ ‘์† ์„ค์ •

์œ„ ๋ช…๋ น์–ด๋ฅผ ์ž…๋ ฅํ•˜๋ฉด rsa key ์Œ์„ ์ƒ์„ฑํ•ด์ค๋‹ˆ๋‹ค.์‹คํ–‰ํ•˜๋ฉด ๋ฐ”๋กœ ํŒŒ์ผ ์œ„์น˜๋ฅผ ์ง€์ •ํ•˜๊ฒŒ ๋˜๋Š”๋ฐ ์•„๋ฌด๊ฒƒ๋„ ์ž…๋ ฅํ•˜์ง€ ์•Š์œผ๋ฉด default๋กœ ~/.ssh/id_rsa๋กœ ์„ค์ •๋ฉ๋‹ˆ๋‹ค. ์ €๋Š” ๋‹ค๋ฅธ key๋“ค๊ณผ์˜ ๊ตฌ๋ถ„์„ ์œ„ํ•ด์„œ id_p

velog.io

 

 

https://techsoda.net/windows10-pem-file-permission-settings/

 

์œˆ๋„์šฐ10 SSH ์ ‘์†์‹œ PEM ํŒŒ์ผ ํผ๋ฏธ์…˜ ์—๋Ÿฌ ํ•ด๊ฒฐ๋ฐฉ๋ฒ• - ํ…Œํฌ์†Œ๋‹ค

์ด ๊ธ€์€ ์œˆ๋„์šฐ10์—์„œ BASH, WSL, ํŒŒ์›Œ์‰˜์„ ํ†ตํ•ด SSH ์ ‘์†์‹œ PEM ํŒŒ์ผ ํผ๋ฏธ์…˜ ์—๋Ÿฌ๊ฐ€ ๋‚ ๋•Œ ํ•ด๊ฒฐ ๋ฐฉ๋ฒ•์— ๋Œ€ํ•ด์„œ ๋‹ค๋ฃจ๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์œˆ๋„์šฐ10์—์„œ OpenSSH ํด๋ผ์ด์–ธํŠธ๋ฅผ ์„ค์น˜ํ•˜๋ฉด ๋ช…๋ นํ”„๋กฌํ”„ํŠธ๋‚˜ ์œˆ๋„์šฐ ํŒŒ

techsoda.net

 

 

 

๋ฐ˜์‘ํ˜•