Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
はじめてのしくじり /fjordbootcamp-211009
Search
haruna tsujita
October 08, 2021
Programming
0
1.1k
はじめてのしくじり /fjordbootcamp-211009
haruna tsujita
October 08, 2021
Tweet
Share
More Decks by haruna tsujita
See All by haruna tsujita
fbc-graduation-napple
harunatsujita
0
76
Rails Girls 2022 LT
harunatsujita
0
500
Other Decks in Programming
See All in Programming
C#および.NETに対する誤解をひも解く
ymd65536
0
310
レイトレ合宿10 レンダラー紹介 / Renderer Introduction, Ray Tracing Camp 10
shocker_0x15
0
560
게임 개발하던 학생이이 세계에선 안드로이드 개발자?
pangmoo
0
110
Новый уровень ML-персонализации Lamoda: Как мы усилили ее в каталоге и перенесли на другие продукты
lamodatech
0
250
WEBアプリケーションにおけるAWS Lambdaを用いた大規模な非同期処理の実践
delhi09
PRO
7
4.4k
4年間変わらなかった YOUTRUSTのアーキテクチャ
daiki1003
1
650
RDBの世界をぬりかえていくモデルグラフDB〜truncus graphによるモデルファースト開発〜
jurabi
0
170
Kotlin Multiplatform at Stable and Beyond (Kotlin Vienna, October 2024)
zsmb
2
380
Serverless renderování Webových komponent
rarous
PRO
0
110
Google Play Consoleデベロッパー アカウントの確認 / Verifying your Play Console developer account
kubode
0
170
Why I Choose NetBeans for Jakarta EE
ivargrimstad
0
340
Progressive Web Apps for Rails developers
siaw23
2
560
Featured
See All Featured
VelocityConf: Rendering Performance Case Studies
addyosmani
325
23k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
46
2k
Clear Off the Table
cherdarchuk
91
320k
How GitHub (no longer) Works
holman
311
140k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Building Applications with DynamoDB
mza
90
6k
How to Think Like a Performance Engineer
csswizardry
17
1k
Teambox: Starting and Learning
jrom
132
8.7k
Helping Users Find Their Own Way: Creating Modern Search Experiences
danielanewman
29
2.2k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
Stop Working from a Prison Cell
hatefulcrawdad
267
20k
Transcript
͡Ίͯͷ͘͠͡Γ SSHଓʹखΛম͍ͨ FJORD BOOT CAMP ॳΊͯͷLTձɹvol.9 napple29ɹΔͳ
ࣗݾհ • napple29 Δͳ • ग़ɿ౦ژ • લ৬ޢࢣɹେֶපӃͷखज़ࣨ / ೝՄอҭԂͷޢࢣ
• 2021.4~ ϑΟϤϧυϒʔτΩϟϯϓͰษڧத • ݱࡏͷϓϥΫςΟεRails
͜ͷLTʹ͍ͭͯ ॳ৺Λࢥ͍ग़͢ܥLT
͜ͷLTʹ͍ͭͯ ॳ৺Λࢥ͍ग़͢ܥLT `ೖձͯ͠12ʙ15ͷ̐ؒΛSSHଓʹඅͨ͜͠ͱ’Λ͖͔͚ͬʹ ࣌ͷࢲֶ͕Μͩ͜ͱΛ͓͠͠·͢
SSHʹ͍ͭͯ ͪΐͬͱͨ͠ࢲ͕ૹΔ
SSHͱʁ • SSHɿSecure SHell • ωοτϫʔΫΛհͯ͠ผͷίϯϐϡʔλʔʹϩάΠϯ͠ɺ ૢ࡞͢ΔͨΊͷιϑτΣΞ
SSHଓͷ͘͠Έ ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ
ൿີ伴 ެ։伴 SSHଓͷ͘͠Έ ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ
ެ։伴 ൿີ伴 ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ SSHଓͷ͘͠Έ
ެ։伴 ϩάΠϯ͍ͨ͠ ൿີ伴 ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ SSHଓͷ͘͠Έ
ൿີ伴 ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ 4283745 SSHଓͷ͘͠Έ ཚ
ެ։伴
ൿີ伴 ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ SSHଓͷ͘͠Έ ฏจ 4283745
ཚ ެ։伴
ൿີ伴 ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ L%*#$!T SSHଓͷ͘͠Έ ҉߸จ
4283745 ཚ ެ։伴
ൿີ伴 ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ SSHଓͷ͘͠Έ 4283745 ެ։伴
ཚ L%*#$!T ҉߸จ
ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ L%*#$!T ൿີ伴 SSHଓͷ͘͠Έ 4283745
ެ։伴 ཚ ҉߸จ
ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ L%*#$!T SSHଓͷ͘͠Έ 4283745 ެ։伴
4283745 ൿີ伴 ཚ ཚ ҉߸จ
ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ L%*#$!T SSHଓͷ͘͠Έ ൿີ伴 {ʓʓ:**}
ϋογϡ {ʓʓ:**} ϋογϡ ެ։伴 ҉߸จ
ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ L%*#$!T SSHଓͷ͘͠Έ ൿີ伴 ҉߸จ
{ʓʓ:**} ϋογϡ {ʓʓ:**} ϋογϡ ެ։伴
ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ L%*#$!T SSHଓͷ͘͠Έ ൿີ伴 {ʓʓ:**}
ϋογϡ {ʓʓ:**} ϋογϡ ެ։伴
҉߸Խ͞Εͨ௨৴ ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ SSHଓͷ͘͠Έ
ͱɺࠓ͜ͷ͘Β͍આ໌Ͱ͖ΔΑ͏ʹͳΓ·͕ͨ͠…
ೖձͨͯ͠ͷΘͨ͠ ԿΛݴ͍ͬͯΔ͔ શ͘Θ͔Βͳ͍
ຓʢΤϯδχΞʣʹΘ͔ΒΜͱݴ͍·͘Δ
ೖձͨͯ͠ͷΘͨ͠ શ͕ͯॳΊͯ
ೖձͨͯ͠ͷΘͨ͠ શ͕ͯॳΊͯ શ͕ͯΑ͘Θ͔Βͳ͍
ೖձͨͯ͠ͷΘͨ͠ શ͕ͯॳΊͯ શ͕ͯΑ͘Θ͔Βͳ͍ શ͕ͯෆ҆
ೖձͨͯ͠ͷΘͨ͠ શ͕ͯॳΊͯ શ͕ͯΑ͘Θ͔Βͳ͍ શ͕ͯෆ҆ པΔਓ͕͍ͳ͍
SSHΓӽ͑ΒΕΔؾ͕͠ͳ͍… ͦͯ͠ɺͱʹ͔͘Ή
࣭Λ͏·͘Ͱ͖ͳ͍
• wakaranνϟϯωϧͰฉ͍ͯΈΔ ࣭ͯ͠ΈΔ͕…
• wakaranνϟϯωϧͰฉ͍ͯΈΔ • ͕ࣝͳͯࣗ͘ͷঢ়گΛ͏·͘આ໌Ͱ͖ͳ͍ ࣭ͯ͠ΈΔ͕…
• wakaranνϟϯωϧͰฉ͍ͯΈΔ • ͕ࣝͳͯࣗ͘ͷঢ়گΛ͏·͘આ໌Ͱ͖ͳ͍ • ฉ͖͍ͨ͜ͱͨ͘͞Μ͋ΔͷʹɺͦΕҎ্ฉ͚ͳ͍ ࣭ͯ͠ΈΔ͕…
• wakaranνϟϯωϧͰฉ͍ͯΈΔ • ͕ࣝͳͯࣗ͘ͷঢ়گΛ͏·͘આ໌Ͱ͖ͳ͍ • ฉ͖͍ͨ͜ͱͨ͘͞Μ͋ΔͷʹɺͦΕҎ্ฉ͚ͳ͍ • ࣭λΠϜͰฉ͖͍͕ͨɺ༐ؾ͕ͳͯ͘ฉ͚ͳ͍… ࣭ͯ͠ΈΔ͕…
༻ޠΛཧղͤͣʹϓϥΫςΟεʹऔΓΉ
༻ޠΛཧղͤͣʹϓϥΫςΟεʹऔΓΉ EX. $ ΛҰൠϢʔβʔͩͱ͔͍ͬͯͳ͔ͬͨ
ൿີ伴 ެ։伴 $ ssh-keygen -t rsa ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ
ʢ͘͞ΒVPSͳͲʣ ྫɹ$ ΛҰൠϢʔβʔͩͱ͔͍ͬͯͳ͔ͬͨ
ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ ྫɹ$ϚʔΫ͕ҰൠϢʔβʔͩͱ͔͍ͬͯͳ͔ͬͨ 1.ઃఆϑΝΠϧΛૢ࡞ $ vi
/etc/ssh/sshd_config
2.ެ։伴Λஔ͘ॴΛ༻ҙ $ mkdir .ssh ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ
ʢ͘͞ΒVPSͳͲʣ ྫɹ$ϚʔΫ͕ҰൠϢʔβʔͩͱ͔͍ͬͯͳ͔ͬͨ 1.ઃఆϑΝΠϧΛૢ࡞ $ vi /etc/ssh/sshd_config
ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ ಉ͡ϢʔβʔͰૢ࡞͠ͳͯ͘ͳΒͳ͍ ྫɹ$ϚʔΫ͕ҰൠϢʔβʔͩͱ͔͍ͬͯͳ͔ͬͨ
rootͰߦ͍ͬͯͨ ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ ʢ͘͞ΒVPSͳͲʣ ྫɹ$ϚʔΫ͕ҰൠϢʔβʔͩͱ͔͍ͬͯͳ͔ͬͨ
permission denied. ެ ։ 伴 ΫϥΠΞϯτଆ ʢࣗʣ αʔόʔଆ
ʢ͘͞ΒVPSͳͲʣ ൿີ伴 ྫɹ$ϚʔΫ͕ҰൠϢʔβʔͩͱ͔͍ͬͯͳ͔ͬͨ
’ࢲҰੜSSHଓͰ͖ͳ͍͔’
• ̍ͭΘ͔Δͱɺ·ͨ̍ͭΘ͔Βͳ͍͜ͱͱग़ձ͏ ࣌ɺ͘͢͝য͍ͬͯͨ
• ̍ͭΘ͔Δͱɺ·ͨ̍ͭΘ͔Βͳ͍͜ͱͱग़ձ͏ • ૣ͘ଔۀͯ͠ಇ͖͍ͨ ࣌ɺ͘͢͝য͍ͬͯͨ
• ̍ͭΘ͔Δͱɺ·ͨ̍ͭΘ͔Βͳ͍͜ͱͱग़ձ͏ • ૣ͘ଔۀͯ͠ಇ͖͍ͨ • ͏ΤϯδχΞఘΊͯɺޢࢣʹΖ͏͔ͳ… ࣌ɺ͘͢͝য͍ͬͯͨ
• ̍ͭΘ͔Δͱɺ·ͨ̍ͭΘ͔Βͳ͍͜ͱͱग़ձ͏ • ૣ͘ଔۀͯ͠ಇ͖͍ͨ • ͏ΤϯδχΞఘΊͯɺޢࢣʹΖ͏͔ͳ… ࣗͰͲ͏ʹͰ͖ͳ͍ͱޛΓɺQˍAͰ࣭ͯ͠Έͨͱ͜Ζ… ࣌ɺ͘͢͝য͍ͬͯͨ
Ͱղܾ🎉 ɹ
͘͠͡ΓɹʹɹSSHଓʹۤઓ͍ͯ͠Δͱ͖ͷࣗ
• ʲશ͘Θ͔Βͳ͍͜ͱ͕Θ͔ͬͨܦݧʳ͕ࣗ৴ʹͳͬͨ ͘͠͡Γ͔ΒֶΜͩ͜ͱ
• ʲશ͘Θ͔Βͳ͍͜ͱ͕Θ͔ͬͨܦݧʳ͕ࣗ৴ʹͳͬͨ • ࠓͰԿ͔ʹͭ·ͮ͘ͱʮͰSSHͰ͖͔ͨΒେৎʯͱࢥ͑Δ ͘͠͡Γ͔ΒֶΜͩ͜ͱ
• ίϛϡχςΟʹର͢Δ҆৺ײ͕ժੜ͑ͨ ͘͠͡Γ͔ΒֶΜͩ͜ͱ
• ίϛϡχςΟʹର͢Δ҆৺ײ͕ժੜ͑ͨ • ใʹ࿈ɹɹϚʔΫ → ϝϯλʔ͞Μ͕ݟʹདྷͯ͘Ε͍ͯͨ ͘͠͡Γ͔ΒֶΜͩ͜ͱ
• ίϛϡχςΟʹର͢Δ҆৺ײ͕ժੜ͑ͨ • ใʹ࿈ɹɹϚʔΫ → ϝϯλʔ͞Μ͕ݟʹདྷͯ͘Ε͍ͯͨ • ࣮ݟकΒΕ͍ͯΔ͜ͱ ͘͠͡Γ͔ΒֶΜͩ͜ͱ
• ίϛϡχςΟʹର͢Δ҆৺ײ͕ժੜ͑ͨ • ใʹ࿈ɹɹϚʔΫ → ϝϯλʔ͞Μ͕ݟʹདྷͯ͘Ε͍ͯͨ • ࣮ݟकΒΕ͍ͯΔ͜ͱ • ॿ͚ͯΒ͑ΔίϛϡχςΟͩͱ͔ͬͯ҆৺ͨ͠
͘͠͡Γ͔ΒֶΜͩ͜ͱ
• ࠀͰ͖͍ͯͳ͍͜ͱͨ͘͞Μ… ͘͠͡Γ͔ΒֶΜͩ͜ͱ
• ࠀͰ͖͍ͯͳ͍͜ͱͨ͘͞Μ… • ·ͩ·ͩൃల్্ɺઈࢍͰ͖ͳ͍ࣗͱ͖߹͍த ͘͠͡Γ͔ΒֶΜͩ͜ͱ
• ࠀͰ͖͍ͯͳ͍͜ͱͨ͘͞Μ… • ·ͩ·ͩൃల్্ɺઈࢍͰ͖ͳ͍ࣗͱ͖߹͍த • ͘͠͡Δ͔Βͦ͜ɺௐΔɺखΛಈ͔͢ɺֶͿʂ ͘͠͡Γ͔ΒֶΜͩ͜ͱ
• ࠀͰ͖͍ͯͳ͍͜ͱͨ͘͞Μ… • ·ͩ·ͩൃల్্ɺઈࢍͰ͖ͳ͍ࣗͱ͖߹͍த • ͘͠͡Δ͔Βͦ͜ɺௐΔɺखΛಈ͔͢ɺֶͿʂ ͬͯ͘͠͡ԕճΓ͢Δͷɺѱ͘ͳ͍ ͘͠͡Γ͔ΒֶΜͩ͜ͱ
͝੩ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠