Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should the permission stays 744 for ~/.ssh/config ? #87

Open
s82522658 opened this issue Jun 27, 2024 · 2 comments
Open

Should the permission stays 744 for ~/.ssh/config ? #87

s82522658 opened this issue Jun 27, 2024 · 2 comments

Comments

@s82522658
Copy link

- Ensure proper permissions for for your .ssh directory: `chmod 600 ~/.ssh/*`

Hi,
I'm currently following your doc to setup my environment.
Should this be changed to "chmod 600 ~/.ssh/ && chmod 744 ~/.ssh/config" to ensure the config file remains readable?

Thank you so much.

@s82522658 s82522658 changed the title Should the permission stays for 755 for ~/.ssh/config ? Should the permission stays 744 for ~/.ssh/config ? Jun 27, 2024
@jk-ozlabs
Copy link
Member

0744 would imply executable, which we definitely don't want. Do you mean 0644?

Is there something that needs it to be group- or world- readable?

@mdmillerii
Copy link
Contributor

mdmillerii commented Oct 16, 2024

Note that chmod 600 ~/.ssh/ will break ssh. For directories x is searchable, meaning that you can access files contained in the directory. Read means that you can list the files in the directory itself. So the ~/.ssh directory needs to have at least 100 if not 700 for ease of use. The current and original article says

chmod 600 ~/.ssh/*

the trailing * says to apply to all contents found via reading the directory, not the directory itself (the . self and .. parent directories are excluded from *. note root implicitly has 600 to all files modulo capabilities such as CAP_SYS_DAC).

Other than excluding read and write from group and other, I don't know that read needs to be denied to others; it would seem to be a tradeoff between sharing configuration to others vs privacy slowing down a breach. In particular, this host config could give an attacker a reason to try an acquired token against a host mentioned in the config. This might be exposed via other means such as you have committed to our project or shell history files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants