blob: b76268849630142b919bccbe4b1999819f1ec311 [file] [log] [blame]
Joey Armstrong56334fc2023-01-15 22:53:19 -05001Gerrit SSH Access
2#################
3
4- `Gerrit Login <https://gerrit.opencord.org/login/%2Fq%2Fstatus%3Aopen%2B-is%3Awip>`_
5
6Generate an :ref:`SSH Key <gerrit-user-account>` for access
7============================================================
8
9.. sourcecode:: shell
10
11 $ ssh-keygen -t ed25519 -f id_gerrit -C 'tux@opennetworking.org'
12
13- Login and configure gerrit
14
15- Verify your ssh connection (manual/explicit args)
Joey Armstrongb8a1e052023-08-07 09:32:53 -040016 - ssh -T -p 29418 -i ~/.ssh/id_gerrit tux@gerrit.opencord.org
Joey Armstrong56334fc2023-01-15 22:53:19 -050017 - -T # disable pseudo terminal access, simple verify
18 - -p(port)
19 - -i(dentity) # ssh key
20 - Expect to see::
21 \*\*\*\* Welcome to Gerrit Code Review \*\*\*\*
22
23 Hi tux, you have successfully connected over SSH.
24
25 Unfortunately, interactive shells are disabled.
26
27
28Load your ssh key(s) to prompt for a passprase once
29===================================================
30
31.. sourcecode:: shell
32
33 # ssh-add will prompt for the passphrase for your key.
34 # This is a one-time operation per login session.
35 $ ssh-add ~/.ssh/id_gerrit
36 $ ssh-add -l
37
38Create ~/.ssh/config to simplify your connections
39=================================================
40.. sourcecode:: shell
41
42 FILE: ~/.ssh/config
Joey Armstrongb8a1e052023-08-07 09:32:53 -040043 # -----------------------------------------------------------------------
44 # AddKeysToAgent yes auto ssh-add key for reuse this login session.
Joey Armstrong56334fc2023-01-15 22:53:19 -050045 # IdentitiesOnly yes only use identity provided, no fallback
Joey Armstrongb8a1e052023-08-07 09:32:53 -040046 # -----------------------------------------------------------------------
Joey Armstrong56334fc2023-01-15 22:53:19 -050047
48 Host github.com
49 IdentityFile ~/.ssh/github.com/id_ed25519
50 IdentitiesOnly yes
Joey Armstrongb8a1e052023-08-07 09:32:53 -040051 AddKeysToAgent yes
Joey Armstrong56334fc2023-01-15 22:53:19 -050052 # (default) Port 22
53 User tux
54
55 Host gerrit.opencord.org
56 Hostname gerrit.opencord.org
57 IdentityFile ~/.ssh/gerrit.opencord.org/id_ed25519
58 IdentitiesOnly yes
Joey Armstrongb8a1e052023-08-07 09:32:53 -040059 AddKeysToAgent yes
Joey Armstrong56334fc2023-01-15 22:53:19 -050060 Port 29418
61 User tux@opennetworking.org
62
63With ~/.ssh/config setup simply connect to the target machine:
64==============================================================
65 - ssh gerrit.opencord.org
66
67
68Secure permissions on ~/.ssh
69============================
70
71.. sourcecode:: shell
72
73 $ chown -R {my_login}:{my_login} ~/.ssh
74 $ chmod -R ~/.ssh u+rwx,og-rwx
75 $ find ~/.ssh -type d -print0 | xargs -0 chmod u=rwx
76 $ find ~/.ssh -type f -print0 | xargs -0 chmod u=r
77 $ find ~/.ssh -name '*.pub' -type f -print0 | xargs -0 chmod u=rw
78 $ chmod u=rw ~/.ssh/config ~/.ssh/known_hosts* ~/.ssh/authorized_keys
79
80Debugging connection problems
81===============================
82 - ssh [-v | -vv | -vvv ] to enable connection debugging.
83 - For conneciton problems be explicit when specifying arguments:
84 - ssh -p(ort) -i(dentity) {user}@{host}
85 - Use ssh-add -D to clear your keyring and force passphrase prompting.