无法在 ssh 中访问点文件和点目录

无法在 ssh 中访问点文件和点目录

客户端是 Macbook Pro(MacOS 13)。服务器 PC 是 Ubuntu 22.04。当我从服务器 shell 执行 sshls ~/.ssh或时ls ~/.config,出现错误cannot access '/home/username/.ssh': Permission denied (os error 13)

因此,我扩展了对目录的访问权限,例如~/.sshby doingchmod 777等等。

sudo chmod 777 ~/.ssh
cd ~/.ssh
sudo chmod 777 . /*

但是,如果我ls ~/.ssh像以前一样操作,我会得到类似的输出cannot access '/home/username/.ssh': Permission denied (os error 13)

我想知道如何解决连接 ssh 时丢失对 dotdirectries 的访问权限的问题。

ls -la

输出是

drwxr-xr-x root     root     4.0 KB Sun Dec  4 18:11:25 2022  ..
.rw-rw-r-- bokutotu bokutotu 472 B  Mon Sep 12 15:05:36 2022  .alias.zsh
.rw------- bokutotu bokutotu 1.6 KB Sat May  7 15:40:48 2022  .bash_history
.rw-r--r-- bokutotu bokutotu 220 B  Sat May  7 14:06:09 2022  .bash_logout
.rw-r--r-- bokutotu bokutotu 3.7 KB Sat May  7 15:32:42 2022  .bashrc
drwx------ bokutotu bokutotu 4.0 KB Wed Dec  7 14:51:22 2022  .cache
drwxrwxr-x bokutotu bokutotu 4.0 KB Fri Nov 11 01:35:02 2022  .cargo
drwxrwxr-x bokutotu bokutotu 4.0 KB Sat May  7 15:44:07 2022  .conda
drwx------ bokutotu bokutotu 4.0 KB Sun Dec 11 03:44:31 2022  .config
drwxrwxr-x bokutotu bokutotu 4.0 KB Sun Nov 27 02:34:41 2022  .dart
drwxrwxr-x bokutotu bokutotu 4.0 KB Sun Nov 27 02:34:42 2022  .dartServer
drwxrwxr-x bokutotu bokutotu 4.0 KB Mon Sep 12 12:19:02 2022  .deno
drwxrwxr-x bokutotu bokutotu 4.0 KB Sat May  7 15:39:51 2022  .enhancd
drwxrwxr-x bokutotu bokutotu 4.0 KB Wed Nov 23 07:05:14 2022  .fiftyone
.rw------- bokutotu bokutotu   0 B  Wed Oct 26 16:08:59 2022  .fim_history
.rw-rw-r-- bokutotu bokutotu  78 B  Sun Nov 27 03:35:12 2022  .flutter
drwxrwxr-x bokutotu bokutotu 4.0 KB Fri Nov 18 13:56:12 2022  .fzf
.rw-rw-r-- bokutotu bokutotu 335 B  Fri Nov 18 13:56:17 2022  .fzf.bash
.rw-rw-r-- bokutotu bokutotu 333 B  Fri Nov 18 13:56:17 2022  .fzf.zsh
.rw-rw-r-- bokutotu bokutotu  85 B  Sat May  7 15:31:43 2022  .gitcofig
.rw-rw-r-- bokutotu bokutotu 385 B  Sun Nov  6 17:33:44 2022  .gitconfig
drwx------ bokutotu bokutotu 4.0 KB Sun Dec 11 03:45:26 2022  .gnupg
drwxrwxr-x bokutotu bokutotu 4.0 KB Mon Nov 21 21:44:20 2022  .gphoto
drwxrwxr-x bokutotu bokutotu 4.0 KB Sun May  8 13:11:05 2022  .grass7
drwxrwxr-x bokutotu bokutotu 4.0 KB Thu Nov 24 14:46:12 2022  .ipython
drwxrwxr-x bokutotu bokutotu 4.0 KB Thu Dec  8 11:17:04 2022  .keras
.rw-rw-r-- bokutotu bokutotu 850 B  Fri Nov 18 13:54:46 2022  .latexmkrc
.rw------- bokutotu bokutotu 165 B  Sun Dec 11 03:35:53 2022  .lesshst
drwx------ bokutotu bokutotu 4.0 KB Mon Sep 12 11:34:23 2022  .local
drwx------ bokutotu bokutotu 4.0 KB Tue Oct 11 12:05:56 2022  .mozilla
.rw------- bokutotu bokutotu   0 B  Mon Sep 12 13:38:59 2022  .node_repl_history
drwxrwxr-x bokutotu bokutotu 4.0 KB Mon Sep 12 13:39:04 2022  .npm
drwx------ bokutotu bokutotu 4.0 KB Sat May  7 15:43:59 2022  .nv
.rw-rw-r-- bokutotu bokutotu 2.7 KB Sat May  7 15:19:47 2022  .nvidia-settings-rc
drwxrwxr-x bokutotu bokutotu 4.0 KB Mon Sep 12 13:38:09 2022  .nvm
drwx------ bokutotu bokutotu 4.0 KB Sat May  7 17:27:31 2022  .pki
.rw-r--r-- bokutotu bokutotu 828 B  Sat May  7 14:57:11 2022  .profile
drwxrwxr-x bokutotu bokutotu 4.0 KB Sun Nov 27 03:33:42 2022  .pub-cache
drwxrwxr-x bokutotu bokutotu 4.0 KB Sun May  8 13:33:10 2022  .pyenv
.rw------- bokutotu bokutotu 2.2 KB Fri Dec  9 16:52:59 2022  .python_history
drwxrwxr-x bokutotu bokutotu 4.0 KB Sat May  7 14:57:16 2022  .rustup
drwx------ bokutotu staff    4.0 KB Wed Dec  7 21:58:54 2022  .ssh
.rw-r--r-- bokutotu bokutotu   0 B  Sat May  7 14:44:44 2022  .sudo_as_admin_successful
drwx------ bokutotu bokutotu 4.0 KB Tue Oct 11 12:05:56 2022  .thunderbird
.rw-rw-r-- bokutotu bokutotu 2.6 KB Fri Nov 18 13:54:46 2022  .tmux.conf
.rw-rw-r-- bokutotu bokutotu 2.9 KB Fri Nov 18 13:54:46 2022  .vimrc
drwxrwxr-x bokutotu bokutotu 4.0 KB Sat May  7 17:27:30 2022  .vscode
drwxrwxr-x bokutotu bokutotu 4.0 KB Sun Dec  4 12:19:49 2022  .vscode-cli
drwx------ bokutotu bokutotu 4.0 KB Sun Dec  4 12:19:49 2022  .vscode-server-insiders
.rw-rw-r-- bokutotu bokutotu 448 B  Fri Dec  9 14:32:35 2022  .wget-hsts
.rw-rw-r-- bokutotu bokutotu  55 KB Sun Dec 11 04:53:56 2022  .zcompdump
drwx------ bokutotu bokutotu 4.0 KB Mon Nov 14 18:43:36 2022  .zoom
.rw------- bokutotu bokutotu 235 KB Sun Dec 11 04:51:52 2022  .zsh_history
.rw-rw-r-- bokutotu bokutotu 6.5 KB Sun Nov 27 03:35:52 2022  .zshrc
drwxrwxr-x bokutotu bokutotu 4.0 KB Sun Nov 27 23:41:12 2022  Code
drwxr-xr-x bokutotu bokutotu 4.0 KB Wed Dec  7 16:36:12 2022  Desktop
drwxr-xr-x bokutotu bokutotu 4.0 KB Sat May  7 14:38:31 2022  Documents
drwxr-xr-x bokutotu bokutotu 4.0 KB Wed Dec  7 21:49:47 2022  Downloads
drwxrwxr-x bokutotu bokutotu 4.0 KB Wed Nov 30 13:32:51 2022  examples
drwx------ bokutotu bokutotu 4.0 KB Sun Dec  4 11:09:16 2022  HDD
drwxrwxr-x bokutotu bokutotu 4.0 KB Tue Oct  4 14:51:07 2022  mount
drwxr-xr-x bokutotu bokutotu 4.0 KB Sat May  7 14:38:31 2022  Music
.rw-rw-r-- bokutotu bokutotu 354 B  Mon Dec  5 20:27:49 2022  path_test.py
drwxr-xr-x bokutotu bokutotu 4.0 KB Thu Dec  8 13:05:53 2022  Pictures
drwxr-xr-x bokutotu bokutotu 4.0 KB Sat May  7 14:38:31 2022  Public
drwx------ bokutotu bokutotu 4.0 KB Wed Nov 30 21:59:13 2022  snap
drwxr-xr-x bokutotu bokutotu 4.0 KB Sat May  7 14:38:31 2022  Templates
drwxr-xr-x bokutotu bokutotu 4.0 KB Sat May  7 14:38:31 2022  Videos
.rw-rw-r-- bokutotu bokutotu 249 B  Tue Nov 29 18:20:34 2022  yavai.py

cannot access '/home/username/.ssh': Permission denied (os error 13)当我ls针对以点开头的目录(例如 ~/.cargo 目录,而不仅仅是 ~/.ssh 目录)时,会出现错误。

相关内容