blob: 879273d57a2553075493f22fb303f2d7fa6805f3 [file] [log] [blame]
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -08001= Permission denied (publickey)
Edwin Kempin014de302011-01-11 13:42:44 +01002
David Pursehouse221d4f62012-06-08 17:38:08 +09003With this error message an SSH command to Gerrit is rejected if the
Edwin Kempin014de302011-01-11 13:42:44 +01004SSH authentication is not successful.
5
Gert van Dijkdc4f8d12017-08-27 21:14:23 +02006The link:http://en.wikipedia.org/wiki/Secure_Shell[SSH] protocol can use
7link:http://en.wikipedia.org/wiki/Public-key_cryptography[Public-key Cryptography]
8for authentication.
9In general configurations, Gerrit will authenticate you by the public keys
10known to you. Optionally, it can be configured by the administrator to allow
11for link:config-gerrit.html#sshd.kerberosKeytab[kerberos] authentication
12instead.
Edwin Kempin014de302011-01-11 13:42:44 +010013
Gert van Dijkdc4f8d12017-08-27 21:14:23 +020014In any case, verify that you are using the correct username for the SSH command
15and that it is typed correctly (case sensitive). You can look up your username
16in the Gerrit Web UI under 'Settings' -> 'Profile'.
Edwin Kempinddfc41a2011-05-06 10:32:05 +020017
Gert van Dijkdc4f8d12017-08-27 21:14:23 +020018If you are facing this problem and using an SSH keypair, do the following:
19
Edwin Kempinddfc41a2011-05-06 10:32:05 +020020. Verify that you have uploaded your public SSH key for your Gerrit
David Pursehousea1d633b2014-05-02 17:21:02 +090021 account. To do this go in the Gerrit Web UI to 'Settings' ->
Edwin Kempinddfc41a2011-05-06 10:32:05 +020022 'SSH Public Keys' and check that your public SSH key is there. If
23 your public SSH key is not there you have to upload it.
24. Verify that you are using the correct private SSH key. To find out
25 which private SSH key is used test the SSH authentication as
26 described below. From the trace you should see which private SSH
27 key is used.
Edwin Kempin014de302011-01-11 13:42:44 +010028
Gert van Dijkdc4f8d12017-08-27 21:14:23 +020029Debugging kerberos issues can be quite hard given the complexity of the
30protocol. In case you are using kerberos authentication, do the following:
31
32. Verify that you have acquired a valid initial ticket. On a Linux machine, you
33 can acquire one using the `kinit` command. List all your tickets using the
34 `klist` command. It should list all principals for which you have acquired a
35 ticket and include a principal name corresponding to your Gerrit server, for
36 example `HOST/gerrit.mydomain.tld@MYDOMAIN.TLD`.
37 Note that tickets can expire and require you to re-run `kinit` periodically.
38. Verify that your SSH client is using kerberos authentication. For OpenSSH
39 clients this can be controlled using the `GSSAPIAuthentication` setting.
40 For more information see
41 link:user-upload.html#configure_ssh_kerberos[SSH kerberos configuration].
Edwin Kempin014de302011-01-11 13:42:44 +010042
Yuxuan 'fishy' Wang61698b12013-12-20 12:55:51 -080043== Test SSH authentication
Edwin Kempin014de302011-01-11 13:42:44 +010044
45To test the SSH authentication you can run the following SSH command.
46This command will print out a detailed trace which is helpful to
47analyze problems with the SSH authentication:
48
49----
Hugo Arès93ef4272016-03-01 21:50:41 -050050 $ ssh -vv -p 29418 john.doe@git.example.com
Edwin Kempin014de302011-01-11 13:42:44 +010051----
52
53If the SSH authentication is successful you should find the following
54lines in the output:
55
56----
57 ...
58
59 debug1: Authentication succeeded (publickey).
60
61 ...
62
63 **** Welcome to Gerrit Code Review ****
64
65 Hi John Doe, you have successfully connected over SSH.
66
67 Unfortunately, interactive shells are disabled.
68 To clone a hosted Git repository, use:
69
70 git clone ssh://john.doe@git.example.com:29418/REPOSITORY_NAME.git
71
72 ...
73----
74
75
76GERRIT
77------
78Part of link:error-messages.html[Gerrit Error Messages]
Yuxuan 'fishy' Wang99cb68d2013-10-31 17:26:00 -070079
80SEARCHBOX
81---------