瞧瞧我在ITX主机上干了些什么!

Windows 11

Github git push

2025.08.27
这个问题出现过很多次了

1
2
3
4
5
6
7
8
9
10
11
ssh: connect to host github.com port 22: Connection timed out
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
FATAL Something's wrong. Maybe you can find the solution here: https://hexo.io/docs/troubleshooting.html
Error: Spawn failed
at ChildProcess.<anonymous> (D:\DevProj\murphyhoucn_blog\node_modules\hexo-deployer-git\node_modules\hexo-util\lib\spawn.js:51:21)
at ChildProcess.emit (node:events:518:28)
at cp.emit (D:\DevProj\murphyhoucn_blog\node_modules\cross-spawn\lib\enoent.js:34:29)
at ChildProcess._handle.onexit (node:internal/child_process:293:12)

因为Github 仓库链接本地使用的是git@ 的 SSH 方式。为git命令配置ssh的网络代理采用下面这种方式。
connect-proxy 是一个非常强大的代理工具,专为 SSH 连接设计,它对 SOCKS5 代理的支持特别好。

1
2
3
4
5
6
7
# C:\Users\cosmi\.ssh\config

Host github.com
HostName ssh.github.com
User git
Port 443
ProxyCommand connect -S 127.0.0.1:7890 %h %p

Ubuntu 22.04 WSL

用户

1
murphyitxwsl@MurphyWinITX:~$

忘记用户的密码了。。。。

  • 重置root密码
1
2
3
# 1. 以管理员身份打开 PowerShell
wsl.exe --user root
passwd root
  • 重置murphyitxwsl用户密码
1
2
wsl.exe --user root
asswd murphyitxwsl

Ubuntu 24.04

Proxy

Ubuntu配置 命令行Clash 教程 - 知乎 (zhihu.com)

终端使用代理加速的正确方式(Clash) | Ln’s Blog (weilining.github.io)
2024.01.10
这部分是再服务器上完成的!

1
2
3
4
gunzip clash-linux-amd64-v1.18.0.gz
mv clash-linux-amd64-v1.18.0 clash
chmod u+x clash
./clash
1
在 ~/.config/clash/config.yaml 写入订阅的内容

image-20240110153702123

1
2
3
4
5
6
7
8
9
10
11
`~/.bashrc`

function proxy() {
export http_proxy=http://127.0.0.1:7890
export https_proxy=$http_proxy
echo -e "proxy on!"
}
function unproxy(){
unset http_proxy https_proxy
echo -e "proxy off"
}
1
2
3
4
5
(base) houjinliang@3080server:~/userdoc$ source ~/.bashrc
(base) houjinliang@3080server:~/userdoc$ proxy
proxy on!
(base) houjinliang@3080server:~/userdoc$ unproxy
proxy off
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(base) houjinliang@3080server:~/userdoc$ wget www.zhihu.com
URL transformed to HTTPS due to an HSTS policy
--2024-01-10 15:33:59-- https://www.zhihu.com/
正在连接 127.0.0.1:7890... 已连接。
已发出 Proxy 请求,正在等待回应... 302 Found
位置://www.zhihu.com/signin?next=%2F [跟随至新的 URL]
URL transformed to HTTPS due to an HSTS policy
--2024-01-10 15:33:59-- https://www.zhihu.com/signin?next=%2F
再次使用存在的到 www.zhihu.com:443 的连接。
已发出 Proxy 请求,正在等待回应... 200 OK
长度: 39879 (39K) [text/html]
正在保存至: “index.html”

index.html 100%[===================================================================================================================>] 38.94K --.-KB/s 用时 0.04s



2024-01-10 15:33:59 (944 KB/s) - 已保存 “index.html” [39879/39879])

(base) houjinliang@3080server:~/userdoc$ wget www.google.com
--2024-01-10 15:34:14-- http://www.google.com/
正在连接 127.0.0.1:7890... 已连接。
已发出 Proxy 请求,正在等待回应... 200 OK
长度: 未指定 [text/html]
正在保存至: “index.html.1”

index.html.1 [ <=> ] 18.72K --.-KB/s 用时 0.07s

2024-01-10 15:34:16 (257 KB/s) - “index.html.1” 已保存 [19169]

Ubuntuer Server user

这部分内容是在服务器上完成的,涉及到权限问题。

增减用户

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# user add
user@3080server:/mnt$ sudo useradd -d "/mnt/songwenming" -m -s "/bin/bash" songwenming
user@3080server:/mnt$ sudo passwd songwenming
新的 密码:
重新输入新的 密码:
passwd:已成功更新密码

# 查看用户和用户组
user@3080server:/mnt$ cat /etc/passwd
……
songwenming:x:1035:1035::/mnt/songwenming:/bin/bash
……

user@3080server:/mnt$ cat /etc/group
……
songwenming:x:1035:
……

# user delete
user@3080server:/mnt$ sudo userdel -r songwenming
[sudo] user 的密码:
userdel: songwenming 邮件池 (/var/mail/songwenming) 未找到

用户权限

1
2
3
4
5
6
7
8
9
> ssh with houjinliang
# change permission
chmod 750 /mnt/houjinliang

#所有者 (User - u): 权限是 7,二进制表示为 111,即 rwx(读、写、执行)。假设您是这个目录的所有者(比如用户 houjinliang),那么您拥有全部权限。
#所属组 (Group - g): 权限是 5,二进制表示为 101,即 r-x(读、执行)。与您在同一个用户组的其他成员可以读取目录内容(ls)和进入该目录(cd),但不能在该目录中创建或删除文件。
#其他人 (Other - o): 权限是 0,二进制表示为 000,即 ---(无权限)。除了所有者和所属组成员之外的任何其他用户,对这个目录没有任何权限。

# 个设置非常适合用来阻止其他普通用户访问您的目录,但它对 root 用户就像不存在一样。 管理员依然可以自由地进入您的目录、读取、修改或删除里面的任何文件。

用于与用户组

1
2
3
4
5
6
7
8
9
10
11
cat /etc/passwd    or    getent passwd
# 这个文件包含了所有用户的基本信息,每一行代表一个用户。
username:password_placeholder:UID:GID:comment:home_directory:login_shell

cat /etc/group or getent group
# 这个文件定义了所有的用户组。
group_name:password_placeholder:GID:members_list

# 查看特定用户的组
user@3080server:/mnt$ groups houjinliang
houjinliang : houjinliang

sudo-特殊的组

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# sudo 权限是通过将用户添加到一个特定的用户组来实现的。
# 在 Debian/Ubuntu 系统中,这个组通常是 sudo。
user@3080server:/mnt$ sudo grep -rE '^%[a-zA-Z_]+' /etc/sudoers /etc/sudoers.d/
/etc/sudoers:%admin ALL=(ALL) ALL
/etc/sudoers:%sudo ALL=(ALL:ALL) ALL

user@3080server:/mnt$ getent group sudo
sudo:x:27:user
# user 拥有 sudo 权限

# 这个方法会直接扫描所有 sudo 配置文件,找出所有被明确授权的用户和组。
user@3080server:/mnt$ sudo grep -rvE '^#|^$' /etc/sudoers /etc/sudoers.d/ | sed 's/#.*//'
/etc/sudoers:Defaults env_reset
/etc/sudoers:Defaults mail_badpass
/etc/sudoers:Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
/etc/sudoers:root ALL=(ALL:ALL) ALL
/etc/sudoers:houjinliang ALL=(ALL) ALL
/etc/sudoers:%admin ALL=(ALL) ALL
/etc/sudoers:%sudo ALL=(ALL:ALL) ALL



# 查看某一用户的sudo权限
# 如果用户有权限,系统会详细列出该用户可以执行的所有命令
# 如果用户没有权限,系统会明确告知
user@3080server:/mnt$ sudo -l -U user
匹配 %2$s 上 %1$s 的默认条目:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

用户 user 可以在 3080server 上运行以下命令:
(ALL : ALL) ALL
user@3080server:/mnt$ sudo -l -U houjinliang
匹配 %2$s 上 %1$s 的默认条目:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

用户 houjinliang 可以在 3080server 上运行以下命令:
(ALL) ALL



# 查看sudo组下的用户
user@3080server:/mnt$ getent group sudo
sudo:x:27:user
用户 (User) 权限级别 (Permission Level) 获得方式 (Method of Grant)
root 超级用户 (Superuser) 系统内置 (System Built-in)
houjinliang 完整 sudo 权限 (Full sudo Access) 直接在 sudoers 文件中指定 (Directly Named in sudoers)
user 完整 sudo 权限 (Full sudo Access) sudo 组成员 (Member of sudo Group)

把用户加入用户组

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# 把houjinliang加入sodo组
user@3080server:/mnt$ sudo usermod -aG sudo houjinliang
user@3080server:/mnt$ getent group sudo
sudo:x:27:user,houjinliang

user@3080server:/mnt$ sudo -l -U houjinliang
匹配 %2$s 上 %1$s 的默认条目:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

用户 houjinliang 可以在 3080server 上运行以下命令:
(ALL) ALL
(ALL : ALL) ALL

user@3080server:~$ sudo vim /etc/sudoers # 把这个手动加的权限“(ALL) ALL”删掉
user@3080server:~$ sudo -l -U houjinliang
匹配 %2$s 上 %1$s 的默认条目:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

用户 houjinliang 可以在 3080server 上运行以下命令:
(ALL : ALL) ALL

user@3080server:~$ groups houjinliang
houjinliang : houjinliang sudo
用户 (User) 权限级别 (Permission Level) 获得方式 (Method of Grant)
root 超级用户 (Superuser) 系统内置 (System Built-in)
houjinliang 完整 sudo 权限 (Full sudo Access) sudo 组成员 (Member of sudo Group)
user 完整 sudo 权限 (Full sudo Access) sudo 组成员 (Member of sudo Group)

user是在sudo组的用户,能看到普通用户的文件吗?

  • user 不是文件的所有者。
  • user不属于该文件的用户组,那么他就会被归类为“其他人”,权限是 0,因此他不能读取文件。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 普通用户755权限,不在组里的用户,可读
drwxr-xr-x 4 songwenming songwenming 4096 9月 4 19:59 songwenming/

user@3080server:~$ cd /mnt/songwenming/
user@3080server:/mnt/songwenming$ cd ..
user@3080server:/mnt$ cd songwenming/
user@3080server:/mnt/songwenming$ ll
总用量 40
drwxr-xr-x 4 songwenming songwenming 4096 9月 4 20:29 ./
drwxr-xr-x 25 root root 4096 9月 4 19:56 ../
-rw------- 1 songwenming songwenming 31 9月 4 19:59 .bash_history
-rw-r--r-- 1 songwenming songwenming 220 4月 5 2018 .bash_logout
-rw-r--r-- 1 songwenming songwenming 3771 4月 5 2018 .bashrc
drwx------ 2 songwenming songwenming 4096 9月 4 19:58 .cache/
drwx------ 3 songwenming songwenming 4096 9月 4 19:58 .config/
-rw-r--r-- 1 songwenming songwenming 807 4月 5 2018 .profile
-rw-rw-r-- 1 songwenming songwenming 10 9月 4 20:29 try.py
-rw------- 1 songwenming songwenming 760 9月 4 20:29 .viminfo
user@3080server:/mnt/songwenming$ cat try.py
import os

user是在sudo用户组,能看chmod 750的用户的文件内容吗?

  • 以user,不加sudo.
1
2
3
4
5
6
7
# 750权限,不在用户组里的用户不可读,不可写,不可执行
# cd进入文件夹属于一种“执行(x)”权限
user@3080server:~$ cd /mnt/houjinliang/
-bash: cd: /mnt/houjinliang/: 权限不够
# cat, 读权限
user@3080server:~$ cat /mnt/houjinliang/MyDevProject/NPUDevCode/GitAuto.sh
cat: /mnt/houjinliang/MyDevProject/NPUDevCode/GitAuto.sh: 权限不够
  • user,加sudo.
1
2
3
4
5
6
7
8
9
10
11
user@3080server:~$ sudo cd /mnt/houjinliang/
[sudo] user 的密码:
sudo: cd:找不到命令

# 使用sudo就破解了权限
user@3080server:~$ sudo cat /mnt/houjinliang/MyDevProject/NPUDevCode/GitAuto.sh

#!/bin/bash
server_name=$(hostname)
…………
…………

引申出一个内容, sudo: cd:找不到命令

这是问题的核心。你可能会非常困惑:“cd 明明是一个命令,为什么 sudo 会说找不到它?”

原因是:Linux 的命令分为两种类型

  1. 外部命令 (External Command):
    • 这些是存在于磁盘上的独立程序文件,比如 /bin/ls, /bin/cat, /usr/bin/grep
    • 当你执行 ls 时,你的 Shell 会在 PATH 环境变量指定的路径中去查找一个叫做 ls 的可执行文件,然后运行它。
    • sudo 正是设计用来运行这些外部命令的。它会在一个安全的路径(secure_path)里去寻找这些程序。
  2. Shell 内建命令 (Shell Built-in Command):
    • 这些命令是 Shell 程序(比如你用的 bash)自身的一部分,它们不是磁盘上的独立文件
    • cd 就是一个最典型的内建命令。此外还有 pwd, echo, export, alias, exit 等。
    • sudo 无法找到 cd 命令,因为它不是一个独立的文件,所以 sudo 在所有程序路径里都找不到它,最终只能报告“找不到命令”。

为什么 cd 必须是内建命令?

想象一下,如果 cd 是一个外部程序。当你运行 cd /some/dir 时,系统会启动一个新的进程来运行 cd 这个程序。这个新进程会成功地把它自己的工作目录切换到 /some/dir,然后……它就退出了。你原来的那个 Shell 进程的工作目录完全没有受到任何影响

所以,为了能够改变当前 Shell 自身的环境(比如当前所在目录),cd 必须是 Shell “内置”的功能,直接在当前进程内执行。

  • 终极方法,切换到root !!!终极无敌权限,不管任何chmod!!!
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 方法一:切换到一个临时的 root Shell (推荐)
# 这会开启一个新的 Shell,而这个 Shell 的用户是 root。
> Ctrl + D, 注销root用户,显示的是“exit"
sudo -s 或 sudo su
user@3080server:~$ sudo -s
root@3080server:/home/user# exit
user@3080server:~$ sudo su
root@3080server:/home/user# exit


# 方法二:切换到一个完整的 root 登录环境
# 这不仅会切换到 root 用户,还会加载 root 用户的完整环境变量,并把当前目录切换到 /root。这被认为是更规范、更安全的做法。
> Ctrl + D, 注销root用户,显示的的"注销"
user@3080server:~$ sudo -i
root@3080server:~# 注销
user@3080server:~$ sudo su -
root@3080server:~# 注销
user@3080server:~$

Win + L锁屏后不熄屏

2025.08.27
https://www.zhihu.com/question/276118015

短按win+l 会锁屏,然后关显示器; 按win+l 持续几秒钟,就会采用你设置的关屏时间,设置成never就永远亮着了。

用户

2025.08.27

  • ubtitx, $pwd
  • root, $pwd…

Flameshot

2025.08.27
https://github.com/flameshot-org/flameshot/issues/3712#issuecomment-2334966021

1
sh -c "QT_QPA_PLATFORM=wayland flameshot gui"

感觉应该是Ubuntu24的QT的问题,直接使用gui的这个命令不行,得改成上面这个有前缀的才可以!

Ubuntu24和Win11双系统,Windows时间不正确

2025.08.27
https://blog.csdn.net/marswill/article/details/141875682

1
2
3
4
sudo apt install ntpdate
sudo apt install util-linux-extra # 在ubuntu24中安装hwclock
sudo ntpdate time.windows.com # 第一条命令是同步时间
sudo hwclock --localtime --systohc # 第二条命令是转换并写入硬件时钟的命令

Grub 主题

2025.08.27
https://zhuanlan.zhihu.com/p/558980080

Ubuntu 24.04隐藏Dock状态栏的Windows未挂载分区图标

2025.08.27
https://www.huoxiaoqiang.com/experience/linux/16045.html

Screenshot from 2025-08-27 17-05-32

中文输入法

2025.08.27
使用Fcitx5

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
安装 Fcitx5 和相关模块
sudo apt update
sudo apt install fcitx5 fcitx5-chinese-addons fcitx5-pinyin

# 设置默认输入法框架。在弹出的窗口中,选择 Yes,然后在接下来的列表中选择 fcitx5,最后点击 OK。
im-config

# 系统设置 (Settings)
在Keyboard中添加中文键盘

# Fcitx5 设置 (Fcitx5 Configuration)
找到 Fcitx5 Configuration
添加Pinyin输入法

# 通过键盘快捷键 Ctrl + Space 来切换到拼音输入法
很奇快!不知道为什么后面这个智能拼音没有了,后面只能重新用Fcitx5 Configuration 的Pinyin了
Screenshot from 2025-08-27 17-10-16
Screenshot from 2025-08-27 17-10-36

Proxy

2025.08.27
https://github.com/clash-verge-rev/clash-verge-rev
https://clashverge.net/

双系统

2025.08.27
没有一个Linux系统感觉还是不太行,于是决定再安装一个双系统。

买了一个铭瑄的512GB硬盘,还搞了一个硬盘支架
IMG_20250827_112249
IMG_20250827_113756
IMG_20250827_114054
IMG_20250827_114301
IMG_20250827_115647
IMG_20250827_120808
安装了俩小时才装完!
IMG_20250827_142525

硬件配置

2024.12.18

教研室工位的电脑用起来受限,决定自己配一台小主机。

Detail
Operation System Windows 11 Pro
CPU Intel Core I5-12400
GPU 核显: Intel UHD Graphics 730
Memory DDR4 64GB 3600(金百达 32 × 2)
Mainboard 铭瑄 B760 ITX
Power TT 550W
Disk 英睿达 P3 PLUS 1TB/HITAI SC001 Active 1TB/KIOXIA 480GB/Maxsun 512GB
CPU Fan 利民 GX90SE V2
机箱 Fan 利民 LT-09 ×2
机箱 机械大师 G60

image-20250606104927751

image-20250828113538134


瞧瞧我在ITX主机上干了些什么!
https://blog.cosmicdusty.cc/post/Tools/WorkingWithITX/
作者
Murphy
发布于
2024年12月18日
许可协议