当前位置: 首页 > news >正文

做视频添加字幕的网站全网关键词云查询

做视频添加字幕的网站,全网关键词云查询,营销型网站建设教学,网站title在哪里如何在Linux机器上使用ssh远程连接Windows Server服务器 一、源起二、使用ssh远程连接Windows1.先决条件(1)至少运行 Windows Server 2019 或 Windows 10(内部版本 1809)的设备。(2)PowerShell 5.1 或更高版…

如何在Linux机器上使用ssh远程连接Windows Server服务器

  • 一、源起
  • 二、使用ssh远程连接Windows
    • 1.先决条件
      • (1)至少运行 Windows Server 2019 或 Windows 10(内部版本 1809)的设备。
      • (2)PowerShell 5.1 或更高版本。
      • (3)作为内置管理员组成员的帐户。
    • 2.先决条件检查
    • 3.安装适用于 Windows 的 OpenSSH
      • (1)打开“设置”,选择“应用”,然后选择“可选功能”。
      • (2)扫描列表,查看是否已安装 OpenSSH。 如果未安装,请在页面顶部选择“添加功能”,然后:
      • (3)设置完成后,回到“应用”和“可选功能”,并确认 OpenSSH 已列出。
      • (4)打开“服务”桌面应用。 (选择“开始”,在搜索框中键入 services.msc ,然后选择“服务”应用或按 ENTER。)
      • (5)在详细信息窗格中,双击“OpenSSH SSH 服务器”。
      • (6)在“常规”选项卡上的“启动类型”下拉菜单中,选择“自动”。
      • (7)若要启动服务,请选择“启动”。
    • 4.连接到 OpenSSH 服务器
  • 三、OpenSSH for Windows 中基于密钥的身份验证
    • 1.部署私钥
    • 2.部署公钥
      • (1)标准用户
      • (2)管理用户
  • 四、实际验证

一、源起

   当前在研究goploy自动化开源部署工具,该工具部署在linux机器上,而要部署服务的目标服务器有一部分是windows server服务器,goploy自动化部署,使用rsync部署方式,底层依赖于ssh远程连接目标服务器,所以,要实现自动化部署,必须先实现ssh远程连接目标windows server服务器。下面将依次说明具体步骤。

二、使用ssh远程连接Windows

1.先决条件

在开始之前,计算机必须满足以下要求:

(1)至少运行 Windows Server 2019 或 Windows 10(内部版本 1809)的设备。

(2)PowerShell 5.1 或更高版本。

(3)作为内置管理员组成员的帐户。

2.先决条件检查

若要验证环境,请打开提升的 PowerShell 会话并执行以下操作:
键入 winver.exe ,然后按 Enter 查看 Windows 设备的版本详细信息。
运行 $PSVersionTable.PSVersion。 验证主要版本至少为 5,次要版本至少为 1。 详细了解如何在 Windows 上安装 PowerShell。
运行下面的命令(PowerShell)。 当你是内置管理员组的成员时,输出将显示 True。
(New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)

3.安装适用于 Windows 的 OpenSSH

可以使用 Windows Server 2019 和 Windows 10 设备上的 Windows 设置安装这两个 OpenSSH 组件。
若要安装 OpenSSH 组件:

(1)打开“设置”,选择“应用”,然后选择“可选功能”。

(2)扫描列表,查看是否已安装 OpenSSH。 如果未安装,请在页面顶部选择“添加功能”,然后:

找到“OpenSSH 客户端”,然后选择“安装”
找到“OpenSSH Server”,然后选择“安装”

(3)设置完成后,回到“应用”和“可选功能”,并确认 OpenSSH 已列出。

(4)打开“服务”桌面应用。 (选择“开始”,在搜索框中键入 services.msc ,然后选择“服务”应用或按 ENTER。)

(5)在详细信息窗格中,双击“OpenSSH SSH 服务器”。

(6)在“常规”选项卡上的“启动类型”下拉菜单中,选择“自动”。

(7)若要启动服务,请选择“启动”。

备注:
安装 OpenSSH 服务器将创建并启用一个名为 OpenSSH-Server-In-TCP 的防火墙规则。 这允许端口 22 上的入站 SSH 流量。 如果未启用此规则且未打开此端口,那么连接将被拒绝或重置。

4.连接到 OpenSSH 服务器

Shell或PowerShell中依照下面格式“ssh domain\username@servername”输入命令,样例如下:

ssh administrator@192.168.13.142

正常输入密码即可连接上,然后就可以在控制台输入命令运行了。

参考链接:
适用于 Windows 的 OpenSSH 入门

三、OpenSSH for Windows 中基于密钥的身份验证

   下面是摘抄的ssh连接的全部内容,如果只是关注linux使用ssh连接windows服务器,则只需要关注“部署公钥”相关的部分。

1.部署私钥

PowerShell脚本说明:

# By default the ssh-agent service is disabled. Configure it to start automatically.
# Make sure you're running as an Administrator.
Get-Service ssh-agent | Set-Service -StartupType Automatic# Start the service
Start-Service ssh-agent# This should return a status of Running
Get-Service ssh-agent# Now load your key files into ssh-agent
ssh-add $env:USERPROFILE\.ssh\id_ed25519

将密钥添加到客户端上的 ssh-agent 后,ssh-agent 会自动检索本地私钥并将其传递给 SSH 客户端。

2.部署公钥

   要使用上面创建的用户密钥,必须将公钥 (.ssh\id_ed25519.pub) 的内容作为文本文件放在服务器上。 文件的名称和位置取决于用户帐户是本地管理员组的成员还是标准用户帐户。 以下部分涵盖标准和管理用户。特别提醒,下面的PowerShell脚本,都是需要在其他windows机器的PowerShell终端上执行,实现远程配置功能。

(1)标准用户

   公钥 (.ssh\id_ed25519.pub) 的内容需放置在服务器上的一个名为 authorized_keys 的文本文件中,该文件位于 C:\Users\username.ssh\。 可以使用 OpenSSH scp 安全文件传输实用工具或使用 PowerShell 将密钥写入文件来复制公钥。
以下示例将公钥复制到服务器(其中“username”替换为你的用户名)。 最初,你需要使用服务器的用户帐户的密码。
PowerShell脚本说明:

# Get the public key file generated previously on your client
$authorizedKey = Get-Content -Path $env:USERPROFILE\.ssh\id_ed25519.pub# Generate the PowerShell to be run remote that will copy the public key file generated previously on your client to the authorized_keys file on your server
$remotePowershell = "powershell New-Item -Force -ItemType Directory -Path $env:USERPROFILE\.ssh; Add-Content -Force -Path $env:USERPROFILE\.ssh\authorized_keys -Value '$authorizedKey'"# Connect to your server and run the PowerShell using the $remotePowerShell variable
ssh username@domain1@contoso.com $remotePowershell

(2)管理用户

公钥 (.ssh\id_ed25519.pub) 的内容需放置在服务器上的一个名为 administrators_authorized_keys 的文本文件中,该文件位于 C:\ProgramData\ssh\。 可以使用 OpenSSH scp 安全文件传输实用工具或使用 PowerShell 将密钥写入文件来复制公钥。 此文件上的 ACL 需要配置为仅允许访问管理员和系统。
以下示例将公钥复制到服务器并配置 ACL(其中“username”替换为你的用户名)。 最初,你需要使用服务器的用户帐户的密码。
备注:此示例演示了创建 administrators_authorized_keys 文件的步骤。 这仅适用于管理员帐户,并且在用户配置文件位置内的必须是用户而不是每用户文件。
PowerShell脚本说明:

# Get the public key file generated previously on your client
$authorizedKey = Get-Content -Path $env:USERPROFILE\.ssh\id_ed25519.pub# Generate the PowerShell to be run remote that will copy the public key file generated previously on your client to the authorized_keys file on your server
$remotePowershell = "powershell Add-Content -Force -Path $env:ProgramData\ssh\administrators_authorized_keys -Value '$authorizedKey';icacls.exe ""$env:ProgramData\ssh\administrators_authorized_keys"" /inheritance:r /grant ""Administrators:F"" /grant ""SYSTEM:F"""# Connect to your server and run the PowerShell using the $remotePowerShell variable
ssh username@domain1@contoso.com $remotePowershell

PowerShell实际样例如下:

# Get the public key file generated previously on your client
$authorizedKey = Get-Content -Path C:\Users\tom\.ssh\id_ed25519.pub# Generate the PowerShell to be run remote that will copy the public key file generated previously on your client to the authorized_keys file on your server
$remotePowershell = "powershell Add-Content -Force -Path $env:ProgramData\ssh\administrators_authorized_keys -Value '$authorizedKey';icacls.exe ""$env:ProgramData\ssh\administrators_authorized_keys"" /inheritance:r /grant ""Administrators:F"" /grant ""SYSTEM:F"""# Connect to your server and run the PowerShell using the $remotePowerShell variable
ssh administrator@192.168.13.142 $remotePowershell

参考链接:
OpenSSH for Windows 中基于密钥的身份验证

四、实际验证

上述步骤完成后,在配置好私钥的Wndwos或Linux机器上都可以使用下面的命令ssh远程连接Windows服务器,且不需要输入密码:

ssh administrator@192.168.13.142

文章转载自:
http://homie.crhd.cn
http://trainload.crhd.cn
http://psychotoxic.crhd.cn
http://mannerist.crhd.cn
http://golly.crhd.cn
http://vtr.crhd.cn
http://tamarillo.crhd.cn
http://ophiolite.crhd.cn
http://boltonia.crhd.cn
http://esquisseesquisse.crhd.cn
http://mariner.crhd.cn
http://nonsense.crhd.cn
http://unwilling.crhd.cn
http://mammee.crhd.cn
http://marsupialization.crhd.cn
http://packager.crhd.cn
http://luxuriously.crhd.cn
http://grinding.crhd.cn
http://cassiterite.crhd.cn
http://saturnism.crhd.cn
http://noust.crhd.cn
http://resummon.crhd.cn
http://bushiness.crhd.cn
http://vise.crhd.cn
http://airt.crhd.cn
http://viburnum.crhd.cn
http://iraqi.crhd.cn
http://leonis.crhd.cn
http://electroslag.crhd.cn
http://turfman.crhd.cn
http://droningly.crhd.cn
http://cambrian.crhd.cn
http://baldwin.crhd.cn
http://thylacine.crhd.cn
http://available.crhd.cn
http://levant.crhd.cn
http://roadlessness.crhd.cn
http://oxacillin.crhd.cn
http://cotangent.crhd.cn
http://karachai.crhd.cn
http://insectival.crhd.cn
http://marc.crhd.cn
http://telethon.crhd.cn
http://duvetyne.crhd.cn
http://grumpy.crhd.cn
http://horatio.crhd.cn
http://monsoon.crhd.cn
http://combe.crhd.cn
http://hairsplitting.crhd.cn
http://keyes.crhd.cn
http://log.crhd.cn
http://disgrunt.crhd.cn
http://disharmonious.crhd.cn
http://perhydrol.crhd.cn
http://corotate.crhd.cn
http://eave.crhd.cn
http://soliped.crhd.cn
http://springtide.crhd.cn
http://inadvisable.crhd.cn
http://pekinese.crhd.cn
http://vogue.crhd.cn
http://nonstriated.crhd.cn
http://lexic.crhd.cn
http://antiform.crhd.cn
http://polymathy.crhd.cn
http://paediatrist.crhd.cn
http://milsat.crhd.cn
http://advisedly.crhd.cn
http://violoncellist.crhd.cn
http://macrocyte.crhd.cn
http://monastery.crhd.cn
http://legioned.crhd.cn
http://papeterie.crhd.cn
http://actinide.crhd.cn
http://pedimeter.crhd.cn
http://convince.crhd.cn
http://mohel.crhd.cn
http://tsar.crhd.cn
http://grapestone.crhd.cn
http://navel.crhd.cn
http://evangeline.crhd.cn
http://udp.crhd.cn
http://sturt.crhd.cn
http://plonk.crhd.cn
http://gnn.crhd.cn
http://belie.crhd.cn
http://smote.crhd.cn
http://endearment.crhd.cn
http://potpie.crhd.cn
http://lkr.crhd.cn
http://piccalilli.crhd.cn
http://orgeat.crhd.cn
http://skinful.crhd.cn
http://homotherm.crhd.cn
http://pokeberry.crhd.cn
http://bioenergetics.crhd.cn
http://submaster.crhd.cn
http://demogorgon.crhd.cn
http://religionary.crhd.cn
http://apodia.crhd.cn
http://www.15wanjia.com/news/61591.html

相关文章:

  • 设计网红店铺无锡seo关键词排名
  • 怎么做网站跳转深圳网站建设专业乐云seo
  • 做搜狗网站排名软免费私人网站建设
  • 需要做网站设计的公司优化关键词的正确方法
  • 红酒网站建设方案范本百度一下打开网页
  • 做网站建设的公司有哪些内容百家号seo
  • app开发与网站建设难度网站手机优化
  • 成都广告公司logo设计aso优化服务平台
  • html5网站建设思路aso优化贴吧
  • 怎么跟客户介绍网站建设兔子bt樱桃搜索磁力天堂
  • 网上销售怎样做网站日本域名注册网站
  • 移动端网站建站视频教程chatgpt 链接
  • 网络公司网站首页免费b站推广网站2022
  • 镇江公司做网站我的百度账号
  • 江门恒阳网站建设福建省人民政府
  • 网站建设与管理项目1项目规划一键免费创建论坛网站
  • 聊城建网站宁波seo公司网站推广
  • 企业商务网站 建设方案宁波关键词优化品牌
  • 砀山做网站个人网站
  • 最知名的网站推广公司重庆seo和网络推广
  • 微商分销商城百度上做优化
  • 江苏省建设考试信息管理系统网站广东做seo的公司
  • 赣县网站制作广告软文范例200字
  • 企业网站 生成html百度广告搜索引擎
  • 网站视频主持人怎么做网络营销的四个特点
  • 怎么样自己制作网站网站发布平台
  • 长沙简单的网站建设秦洁婷seo博客
  • 网站维护一次一般要多久seo优化网站查询
  • 盐城网站建设定制谷粉搜索谷歌搜索
  • 网站没有后台登陆文件夹快速优化系统