diff --git a/.obsidian/plugins/obsidian-git/data.json b/.obsidian/plugins/obsidian-git/data.json index b3409c6..be93772 100644 --- a/.obsidian/plugins/obsidian-git/data.json +++ b/.obsidian/plugins/obsidian-git/data.json @@ -50,7 +50,9 @@ }, "textColorCss": "var(--text-muted)", "ignoreWhitespace": false, - "gutterSpacingFallbackLength": 5 + "gutterSpacingFallbackLength": 5, + "lastShownAuthorDisplay": "initials", + "lastShownDateTimeFormatOptions": "date" }, "autoCommitMessage": "vault backup: {{date}}" } \ No newline at end of file diff --git a/.obsidian/workspace.json b/.obsidian/workspace.json index 207e8af..a6ba32f 100644 --- a/.obsidian/workspace.json +++ b/.obsidian/workspace.json @@ -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 } @@ -69,7 +69,7 @@ } ], "direction": "horizontal", - "width": 217.5, + "width": 321.5, "collapsed": true }, "right": { @@ -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", @@ -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 } @@ -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" } } }, @@ -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", @@ -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", diff --git "a/_posts/pool/2024-09-12-\350\256\260\344\270\200\346\254\241\347\246\273\345\245\207\347\232\204linux-ssh\347\231\273\345\275\225bug.md" "b/_posts/pool/2024-09-12-\350\256\260\344\270\200\346\254\241\347\246\273\345\245\207\347\232\204linux-ssh\347\231\273\345\275\225bug.md" new file mode 100644 index 0000000..a2a4203 --- /dev/null +++ "b/_posts/pool/2024-09-12-\350\256\260\344\270\200\346\254\241\347\246\273\345\245\207\347\232\204linux-ssh\347\231\273\345\275\225bug.md" @@ -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 +``` \ No newline at end of file