Ubuntu安裝PowerShell
Ubuntu安裝PowerShell幫助文檔
# Download the Microsoft repository GPG keys
wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
# Register the Microsoft repository GPG keys
sudo dpkg -i packages-microsoft-prod.deb
# Update the list of products
sudo apt-get update
# Enable the "universe" repositories
sudo add-apt-repository universe
# Install PowerShell
sudo apt-get install -y powershell
# Start PowerShell
pwsh
配置Ubuntu允許PowerShell通過SSH連接
配置Ubuntu允許PowerShell通過SSH連接
# 安裝SSH
sudo apt install openssh-client
sudo apt install openssh-server
# 編輯 /etc/ssh 位置中的 sshd_config 文件。
# 確保已啟用密碼身份驗證:
PasswordAuthentication yes
# 添加 PowerShell 子系統條目:
Subsystem powershell /usr/bin/pwsh -sshs -NoLogo -NoProfile
# 啟用密鑰身份驗證(可選)
PubkeyAuthentication yes
重啟 sshd 服務
sudo service sshd restart
在Windows下通過PowerShell 連接 Ubuntu
通過PowerShell 連接 Ubuntu
New-PSSession -HostName UserA@LinuxServer01

參考文檔