安装sshd
打开“设置”,选择“应用”>“应用和功能”,然后选择“可选功能” 。
扫描列表,查看是否已安装 OpenSSH。 如果未安装,请在页面顶部选择“添加功能”,然后:
查找“OpenSSH 客户端”,再单击“安装”
查找“OpenSSH 服务器”,再单击“安装”

开启sshd服务
# Start the sshd service
Start-Service sshd
# OPTIONAL but recommended:
Set-Service -Name sshd -StartupType 'Automatic'

免密登录
服务端切换到C:\ProgramData\ssh\下(首次启动sshd后会生成该文件夹),打开sshd_config文件,
修改文件(以下是重点):

确保以下3条没有被注释
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication no

确保以下2条有注释掉 重点,这两行要注释
#Match Group administrators
# AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

相关命令:
查看状态:Get-Service sshd
关闭服务:Stop-Service sshd
重启服务:Restart-Service sshd

为 Win10 的 OpenSSH 配置默认 shell
先确认 OpenSSH 默认安装位置是:C:Windows\System32\openssh 。
cmd 中 path 和 PowerShell 中 $env:path 可以显示当前路径。
在 PowerShell 中用以下命令将默认 shell 设为 PowerShell:
New-ItemProperty -Path "HKLM:\SOFTWARE\OpenSSH" -Name DefaultShell -Value "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -PropertyType String -Force

powerShell 配置

安装需要的软件
Install-Module -AllowClobber Get-ChildItemColor

choco install ntop.portable

查看profile
$PROFILE

编辑profile 内容如下

set-alias vi "C:/Program Files (x86)/Vim/vim82/./vim.exe"
set-alias git "C:/Program Files/Git/bin/./git.exe"

set-alias top "C:/ProgramData/chocolatey/bin/ntop.exe"

Import-Module PSReadLine
If (-Not (Test-Path Variable:PSise)) {
  # Only run this in the console and not in the ISE
  Import-Module Get-ChildItemColor
  Set-Alias l Get-ChildItem -option AllScope
  Set-Alias ls Get-ChildItemColorFormatWide -option AllScope
}

# Shows navigable menu of all options when hitting Tab
Set-PSReadlineKeyHandler -Key Tab -Function MenuComplete

# Autocompletion for arrow keys
Set-PSReadlineKeyHandler -Key UpArrow -Function HistorySearchBackward
Set-PSReadlineKeyHandler -Key DownArrow -Function HistorySearchForward

New-Alias open invoke-item
New-Alias which get-command

引用链接
https://zhuanlan.zhihu.com/p/356463854
https://docs.microsoft.com/zh-cn/windows-server/administration/openssh/openssh_install_firstuse
https://www.cnblogs.com/deepinnet/p/15228378.html
https://ld246.com/article/1598698273711

最新文章

  1. sz rz SecureCRT
  2. Python自动化之django视图
  3. iOS开发-- RunLoop的基本概念与例子分析
  4. HDU-4089 Activation (概率DP求概率)
  5. R语言串行与并行Apply用法
  6. 使用Application_Error捕获站点错误并写日志
  7. .NET Core 2.0 Preview2 发布汇总
  8. Abp异常-找不到方法:“System.String Abp.Runtime.Security.SimpleStringCipher.Decrypt(System.String, System.String, Byte[])”
  9. Python(五) —— 内置模块
  10. spring jdbcTemplate 事务,各种诡异,包你醍醐灌顶!
  11. C# 生成编号(防并发)
  12. 快速入门Splay
  13. vue 父子组件的方法调用
  14. shell for 循环数组
  15. MT【96】一道三角恒等变换题
  16. iOS开发-Certificates、Identifiers和Profiles详解
  17. C#或Python中正则表达式元字符含意
  18. [Openwrt 项目开发笔记]:Openwrt平台搭建(一)补遗
  19. WPF性能调试系列 – Ants Performance Profiler
  20. 设计模式--观察者模式C++实现

热门文章

  1. LeetCode-1001 网格照明
  2. 制造业常用KPI
  3. 前端js下载excel
  4. navigator跳转
  5. sparksql的join有哪些及实现原理
  6. git 的提交与合并
  7. JS语句创建简单表格
  8. 使用Telnet伪造邮件发送
  9. dcat-admin主题
  10. 02.java基础(一)java的基础、方法和数组