New-PSSession -SSHTransport -UserName SpockAdmin -KeyFilePath /Users/tsulli/Spocks_Private_Key.pem -HostName x.x.x.x
New-PSSession : [xxxx] ๋ฐฑ๊ทธ๋ผ์ด๋ ํ๋ก์ธ์ค์์ ๋ค์ ๋ฉ์์ง์ ํจ๊ป ์ค๋ฅ๋ฅผ ๋ณด๊ณ ํ์ต๋๋ค. SSH ํด๋ผ์ด์ธํธ ์ธ์ ์ด ์ค๋ฅ ๋ฉ์์ง์ ํจ๊ป ์ข ๋ฃ๋์์ต๋๋ค: ์ฑ๋ 0์์ ์๋ธ์์คํ ์์ฒญ์ด ์คํจํ์ต๋๋ค.
์ฐธ๊ณ : Mac์์ ssh
๋ช
๋ น์ค ํด๋ผ์ด์ธํธ๋ฅผ ์ฌ์ฉํ์ฌ ์์คํ
์ SSH๋ก ์ฑ๊ณต์ ์ผ๋ก ์ฐ๊ฒฐํ ์ ์์ต๋๋ค.
๋ค์ ๋ฌธ์์ ์ค๋ช
๋ ๋๋ก sshd_config
์ Subsystem
๊ตฌ์ฑ์ด ํฌํจ๋์ด ์๋์ง ํ์ธํ์ธ์.
https://docs.microsoft.com/en-us/powershell/scripting/core-powershell/ssh-remoting-in-powershell-core
sshd_config
์์ ํ ํ Windows ์ธ์คํด์ค์์ SSH ๋ฐ๋ชฌ Restart-Service -Name sshd
๋ ๋ค์ ์์ํด์ผ ํฉ๋๋ค.
์์ ์ฌํญ์ ์ฐพ์์ผ๋ฏ๋ก ์ฆ์ ๋ซ์ต๋๋ค. ์ด๊ฒ์ ์์ ํ ์ปค๋ฎค๋ํฐ ๋ฌธ์ํ ๋ชฉ์ ์ผ๋ก ๊ฒ์๋๋ฏ๋ก ๋ค๋ฅธ ์ฌ๋๋ค์ด ๋ด ํ์ต์ผ๋ก๋ถํฐ ํํ์ ๋ฐ์ ์ ์์ต๋๋ค.
sshd_config๋ OpenSSH๊ฐ ์ค์น๋ ์์น๊ฐ ์๋ %ProgramData%ssh์ ์์ต๋๋ค.
๋ฌธ์ ๋ ํ์ ์์คํ ์ ์ถ๊ฐํ ํ์๋ ๊ณ์ ์กด์ฌํฉ๋๋ค. 'sshd -T'๋ฅผ ์คํํ๋ฉด ๋ด ๊ตฌ์ฑ์ด ์ด๋ฏธ ๋ก๋๋์์์ ๋ณด์ฌ์ค๋๋ค.
PS> sshd -T | select-string 'subsystem'
subsystem sftp sftp-server.exe
subsystem powershell c:\pwsh\pwsh.exe -sshs -NoLogo -NoProfile
ssh cmd๋ ์ฌ์ ํ 'powershell'์ด๋ผ๋ ์ด๋ฆ์ ์์๋ผ ์ ์์ต๋๋ค.
PS> ssh [email protected] -s powershell
Authorized users only. All activity may be monitored and reported.
Password:
subsystem request failed on channel 0
์ด์ ์์คํ :
PS>((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows nt\CurrentVersion\" -Name ProductName).ProductName)
Windows 7 Professional
๋ด openssh ๋ฒ์ ์
PS>((Get-Item (Get-Command sshd).Source).VersionInfo.FileVersion)
7.7.2.0
ํ์์ ๋ฒ์
PS> $PSVersionTable
Name Value
---- -----
PSVersion 6.1.0
PSEdition Core
GitCommitId 6.1.0
OS Microsoft Windows 6.1.7601 S
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
ํ์ ์์คํ powershell pwsh.exe -sshs -NoLogo -NoProfile