Skip to content

Commit

Permalink
vault backup: 2024-09-12 17:36:52
Browse files Browse the repository at this point in the history
  • Loading branch information
cmgzn committed Sep 12, 2024
1 parent f641733 commit ec5dc56
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .obsidian/plugins/obsidian-git/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@
},
"textColorCss": "var(--text-muted)",
"ignoreWhitespace": false,
"gutterSpacingFallbackLength": 5
"gutterSpacingFallbackLength": 5,
"lastShownAuthorDisplay": "initials",
"lastShownDateTimeFormatOptions": "date"
},
"autoCommitMessage": "vault backup: {{date}}"
}
21 changes: 11 additions & 10 deletions .obsidian/workspace.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
"type": "split",
"children": [
{
"id": "22b42069fa3e3c3d",
"id": "1dfb6a46a1484898",
"type": "tabs",
"children": [
{
"id": "b395958abd22bf21",
"id": "3122a401b1a08a27",
"type": "leaf",
"state": {
"type": "markdown",
"state": {
"file": "_posts/engineering/2024-09-10-linux(wget)国内批量下载huggingface模型shell脚本.md",
"file": "_posts/pool/2024-09-12-记一次离奇的linux-ssh登录bug.md",
"mode": "source",
"source": false
}
Expand Down Expand Up @@ -69,7 +69,7 @@
}
],
"direction": "horizontal",
"width": 217.5,
"width": 321.5,
"collapsed": true
},
"right": {
Expand All @@ -86,7 +86,7 @@
"state": {
"type": "backlink",
"state": {
"file": "_posts/engineering/2024-09-10-linux(wget)国内批量下载huggingface模型shell脚本.md",
"file": "_posts/pool/2024-09-12-记一次离奇的linux-ssh登录bug.md",
"collapseAll": false,
"extraContext": false,
"sortOrder": "alphabetical",
Expand All @@ -103,7 +103,7 @@
"state": {
"type": "outgoing-link",
"state": {
"file": "_posts/engineering/2024-09-10-linux(wget)国内批量下载huggingface模型shell脚本.md",
"file": "_posts/pool/2024-09-12-记一次离奇的linux-ssh登录bug.md",
"linksCollapsed": false,
"unlinkedCollapsed": true
}
Expand All @@ -126,7 +126,7 @@
"state": {
"type": "outline",
"state": {
"file": "_posts/engineering/2024-09-10-linux(wget)国内批量下载huggingface模型shell脚本.md"
"file": "_posts/pool/2024-09-12-记一次离奇的linux-ssh登录bug.md"
}
}
},
Expand Down Expand Up @@ -156,10 +156,12 @@
"obsidian-git:Open Git source control": false
}
},
"active": "b395958abd22bf21",
"active": "3122a401b1a08a27",
"lastOpenFiles": [
"_posts/engineering/2024-09-09-linux新机器安装nvidia驱动.md",
"_posts/engineering/2024-09-11-git版本管理常见技巧.md",
"_posts/pool/2024-09-12-记一次离奇的linux-ssh登录bug.md",
"_posts/engineering/2024-09-10-linux(wget)国内批量下载huggingface模型shell脚本.md",
"_posts/engineering/2024-09-09-linux新机器安装nvidia驱动.md",
"_posts/engineering/2024-09-05-免费且私密的联网搜索组件duckduckgo.md",
"assets/img/Dingtalk_20240906103705.jpg",
"assets/img/Dingtalk_20240906094335.jpg",
Expand All @@ -172,7 +174,6 @@
"_posts/engineering/2024-09-06-github_page+obsidian实现个人笔记云管理.md",
"_posts/engineering/2024-09-04-windows命令行下载url文件.md",
"_posts/engineering/2024-09-04-conda重命名.md",
"_posts/engineering/2024-09-10-linux(wget)国内批量下载huggingface模型shell脚本.md",
"_posts/engineering/2024-09-06-windows无cpu启动stable-diffusion API接口.md",
"_posts/engineering/2024-08-13-transformers.Trainer中wandb的关闭.md",
"_posts/pool/2024-08-13-generator.md",
Expand Down
48 changes: 48 additions & 0 deletions _posts/pool/2024-09-12-记一次离奇的linux-ssh登录bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: 记一次离奇的linux-ssh登录bug
author: X
date: 2024-09-12 17:16:10 +0800
categories:
- debug
- linux
tags:
- linux
- ssh
---
遇到了一个脑瘫错误,查了半天查到一样的问题

https://askubuntu.com/questions/1404304/sudo-su-command-not-working-su-failed-to-execute-root-no-such-file-or-director

目前已根据文档中提到的方法解决,即修改`/etc/passwd`文件中的`root:x:0:0:root:/root:root`。当然,在我的问题里,这个错误行是`root:x:0:0:root:/root:myusername`

具体是什么原因引起的已经不可追溯了,推测与我想修改新用户的shell时执行的一些操作有关,例如`chsh`相关操作。

实际上这个问题并不是我在切换用户时发现的,而是连接ssh时突然连不上了,报错belike:

```
[16:40:45.445] Got some output, clearing connection timeout
[16:40:45.642] > root@xxxhost: Permission denied (publickey).
[16:40:45.663] > 过程试图写入的管道不存在。
```

还好此时我还有一个vscode窗口是连着这个服务器的root账号的,真是吓出一身冷汗,立刻开始搜索办法。结果当然是五花八门,笔者大量使用`sudoedit /etc/ssh/sshd_config`来修改ssh设定,依旧没有任何用处,期间还检查了`.ssh`下的公钥,也都是正确的。

所以说debug是非常看运气的,主要这个环节的报错是**Permission denied (publickey)**,可以说相当具有迷惑性了,想到切换用户也只是病急乱投医地碰运气,思路是回溯出错环节->之前设置新用户相关时,发现切换用户需要密码,因此重设了root密码->想着再切换一次用户(这个思路是多么离奇,正常来说是完全无用的行为)->发现切不回去了->发现事情真相……

是的,聪明的你已经发现了,最终错因与重设root密码这一操作完全没有关系,这就是debug的魅力,即毫无方法论,除非你有很强的知识储备。然而知识不就是在无数次没头脑的debug中学习的吗?

另,补充修改系统文件的命令:
```bash
sudo nano /etc/passwd
```
或:
```bash
sudoedit /etc/passwd
```

编辑完成后,`ctrl+X`保存退出。

有时修改前也要注意备份,养成好习惯:
```bash
sudo cp /etc/passwd /etc/passwd.bak
```

0 comments on commit ec5dc56

Please sign in to comment.