Score:0

Unable to access dotfiles and dotdirectories in ssh

us flag

The client is a Macbook Pro (MacOS 13). Server PC is Ubuntu 22.04. When I,ssh and do ls ~/.ssh or ls ~/.config from the server shell, I get an error cannot access '/home/username/.ssh': Permission denied (os error 13).

So, I have expanded access permissions to directories such as ~/.ssh by doing chmod 777 and so on.

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

However, if I do ls ~/.ssh as before, I get output like cannot access '/home/username/.ssh': Permission denied (os error 13).

I would like to know how to solve the problem of losing access permission to dotdirectries when connecting to ssh.

ls -la

output is

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

I get the error cannot access '/home/username/.ssh': Permission denied (os error 13) when I ls for directories that start with dot, such as the ~/.cargo directory, not just the ~/.ssh directory.

in flag
There are a number of things that do not add up here. The `.ssh` directory should have permissions set to `700`, otherwise a lot of utilities will refuse to read the files. The contents of `.ssh` should have their permissions set to `600`, otherwise a lot of utilities will refuse to read the file. The `os error 13` is generally seen when the directory is held on an NTFS partition owned by a different user. Not sure why there is a mention of the client, as it's irrelevant if you're connected to the server via SSH. Could you [edit] your question to include specifics about the server permissions?
us flag
@matigo thank you for your comment. I'm not familiar with linux permissions. So I have no idea what information is needed. Could you give me advice?
us flag
@matigo My problem is that I get the same error not only for the ssh directory but also for other directories starting with dot.
in flag
Is this directory located on a network share or on your local machine? Has anyone been fiddling around with ACLs?
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.