AppX 常用命令

AppX 是什么

通用 Windows 平台应用,是 Windows 操作系统分发的移动应用程序。(摘自维基百科)

平时常见的系统内置应用通常就是 AppX。

常用命令

  • Add-AppxPackage —— 将已签名的应用包添加到用户帐户
  • Get-AppxPackage —— 获取用户配置文件中安装的应用程序包的列表
Read More

SSH远程登录配置文件详解

配置文件在/etc/ssh/目录

ssh_configsshd_config 都是 ssh 服务器的配置文件,二者区别在于,前者是针对客户端的配置文件,后者则是针对服务端的配置文件。两个配置文件都允许你通过设置不同的选项来改变客户端程序的运行方式。

1.ssh_config 文件

内容:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# Site-wide defaults for various options
Host *
ForwardAgent no
ForwardX11 no
RhostsAuthentication no
RhostsRSAAuthentication no
RSAAuthentication yes
PasswordAuthentication yes
FallBackToRsh no
UseRsh no
BatchMode no
CheckHostIP yes
StrictHostKeyChecking no
IdentityFile ~/.ssh/identity
Port 22
Cipher blowfish
EscapeChar

详解:
# Site-wide defaults for various options

Read More

SSH密钥登录

1.使用 ssh-keygen 创建一个密钥对

服务器和本地都可以生成(此处在服务器上生成)

1
2
3
4
5
6
7
[root@host ~]$ ssh-keygen -t rsa
Enter file in which to save the key (/root/.ssh/id_rsa): <== 按 Enter(选择默认路径)
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): <== 输入密钥锁码,或直接按 Enter 留空
Enter same passphrase again: <== 再输入一遍密钥锁码
Your identification has been saved in /root/.ssh/id_rsa. <== 私钥
Your public key has been saved in /root/.ssh/id_rsa.pub. <== 公钥

密钥锁码在使用私钥时必须输入,这样就可以保护私钥不被盗用。当然,也可以留空,实现无密码登录

2.服务器安装公钥

1
2
[root@host ~]$ cd .ssh
[root@host .ssh]$ cat id_rsa.pub >> authorized_keys <== 追加公钥内容到authorized_keys文件中

没有 authorized_keys 文件就自己创建一个
然后修改权限

Read More

CentOS 8 开启 TCP_BBR

CentOS 8 Linux kernel 版本为 4.18.0kernel 版本高于 4.9.0,因此同时支持 BBRNV 拥塞算法,但默认未启动 BBR,这里我们可以手动开启。

查看当前拥塞算法

1
2
3
4
$ sysctl net.ipv4.tcp_congestion_control
net.ipv4.tcp_congestion_control = cubic
$ sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic

加载tcp_bbr.ko模块

1
2
3
$ modprobe tcp_bbr
$ sysctl net.ipv4.tcp_available_congestion_control
net.ipv4.tcp_available_congestion_control = reno cubic bbr

自动加载tcp_bbr.ko模块

1
2
3
$ echo "tcp_bbr" >> /etc/modules-load.d/bbr.conf        # 没有这个文件的话自己创建
$ cat /etc/modules-load.d/bbr.conf
tcp_bbr

修改sysctl

1
2
3
4
5
6
$ echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf      
$ echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
$ sysctl -p
vm.swappiness = 15
net.core.default_qdisc = fq
net.ipv4.tcp_congestion_control = bbr

Read More

WSL2设置代理

不同于 WSL1 网络可以与宿主机共享,WSL2 是基于 Hyper-v 虚拟机的,它拥有一个新的网段,所以简单地使用代理,允许来自局域网的连接的旧方法就不奏效了,需要额外获取宿主机的 IP 进行设置

查看宿主机 IP

/etc/resolv.conf 里就有保存的 IP,可以用下面的命令查看

1
cat /etc/resolv.conf | grep nameserver | awk '{ print $2 }'

设置环境变量

1
2
3
export http_proxy='http://<Windows IP>:<Port>'
export https_proxy='http://<Windows IP>:<Port>'
export all_proxy='socks5://<Windows IP>:<Port>'

Read More