Dkngit 发布的文章

本地转发:

ssh -L [LOCAL_IP:]LOCAL_PORT:DESTINATION:DESTINATION_PORT [USER@]SSH_SERVER
  • [LOCAL_IP:]LOCAL_PORT - The local machine IP address and port number. When LOCAL_IP is omitted, the ssh client binds on the localhost.
  • DESTINATION:DESTINATION_PORT - The IP or hostname and the port of the destination machine.
  • [USER@]SERVER_IP - The remote SSH user and server IP address.
ssh -L 5901:127.0.0.1:5901 -N -f user@remote.host

The -f option tells the ssh command to run in the background and -N not to execute a remote command. We are using localhost because the VNC and the SSH server are running on the same host.

远程转发:

ssh -R [REMOTE:]REMOTE_PORT:DESTINATION:DESTINATION_PORT [USER@]SSH_SERVER
  • [REMOTE:]REMOTE_PORT - The IP and the port number on the remote SSH server. An empty REMOTE means that the remote SSH server will bind on all interfaces.
  • DESTINATION:DESTINATION_PORT - The IP or hostname and the port of the destination machine.
  • [USER@]SERVER_IP - The remote SSH user and server IP address.
GatewayPorts yes

允许从外部访问远程主机转发端口

ssh -R 8080:127.0.0.1:3000 -N -f user@remote.host

The command above will make the ssh server listen on port 8080, and tunnel all traffic from this port to your local machine on port 3000.

https://linuxize.com/post/how-to-setup-ssh-tunneling/

执行命令

查询当前激活信息/系统版本(确保是支持KMS的版本):
slmgr /dlv

安装对应GVLK密钥(如果是从VLSC下载VL版本已经内置,不需要安装)
注:VL版本的镜像文件名是SW_DVD开头。MSDN下的是测试版本不是VL版本。
slmgr /ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx

设置KMS服务器地址
slmgr /skms kms.example.com

手动执行激活请求(KMS服务正常的话,手动点立即激活一样效果,不点过一段时间也会自己请求)
slmgr /ato

查询过期时间
slmgr /xpr

GVLK

官网GVLK表
Windows/Server

Windows Server 2012 R2 Standard
D2N9P-3P6X9-2R39C-7RTCD-MDVJX

KMS激活Windows/Office口袋指南

查询占用端口的程序
Get-Process -Id (Get-NetTCPConnection -LocalPort 1080).OwningProcess

文件 Hash
CertUtil -hashfile pathToFileToCheck [HashAlgorithm]
MD2 MD4 MD5 SHA1 SHA256 SHA384 SHA512

tail in 'Windows Powershell'
Get-Content -Path "C:\scripts\test.txt" -Wait

ssh 文件上传
scp /path/to/local/example.txt user@remote_server:/path/to/remote/