Skip to content

Commit 20d70db

Browse files
authored
Update passwordless.md (raspberrypi#1743)
* Update passwordless.md Remark on setting correct directory permissions if connecting via ssh fails * Fixed grammar in passwordless.md * use $HOME for chmod in passwordless.md
1 parent d3e5117 commit 20d70db

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

remote-access/ssh/passwordless.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,25 @@ If this does not work, you can get assistance on the [Raspberry Pi forums](https
8484

8585
**Note:** you can also send files over SSH using the `scp` command (secure copy). See the [SCP guide](scp.md) for more information.
8686

87+
## Adjust permissions for your home and .ssh directories
88+
89+
If you can't establish a connection after following the steps above there might be a problem with your directory permissions. First, you want to check the logs for any errors:
90+
91+
```bash
92+
tail -f /var/log/secure
93+
# might return:
94+
Nov 23 12:31:26 raspberrypi sshd[9146]: Authentication refused: bad ownership or modes for directory /home/pi
95+
```
96+
97+
If the log says `Authentication refused: bad ownership or modes for directory /home/pi` there is a permission problem regarding your home directory. SSH needs your home and `~/.ssh` directory to not have group write access. You can adjust the permissions using `chmod`:
98+
99+
```bash
100+
chmod g-w $HOME
101+
chmod 700 $HOME/.ssh
102+
chmod 600 $HOME/.ssh/authorized_keys
103+
```
104+
Now only the user itself has access to `.ssh` and `.ssh/authorized_keys` in which the public keys of your remote machines are stored.
105+
87106
## Store the passphrase in the macOS keychain
88107

89108
If you are using macOS, and after verifying that your new key allows you to connect, you have the option of storing the passphrase for your key in the macOS keychain. This allows you to connect to your Raspberry Pi without entering the passphrase.

0 commit comments

Comments
 (0)