Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'll anticipate that from time to time you'll want to be able to log in as jenkins to do other tasks, and so I'll solve the more general problem. A strict answer to your question is included at the end.</p> <p><strong>Change jenkins' password without knowing it</strong></p> <p>From any account which has <a href="http://manpages.ubuntu.com/manpages/lucid/en/man8/sudo.8.html" rel="noreferrer">sudo</a> permissions, you can reset jenkins' password to something of your choosing:</p> <pre><code>sudo passwd jenkins </code></pre> <p>You may be asked first for your own password, in order to use sudo. Then you will be prompted for the new password to set for jenkins, and finally a confirmation of that new password.</p> <p>If your user with sudo rights is called joe, here's how a session might look:</p> <pre><code>joe $ sudo passwd jenkins [sudo] password for joe: **you enter joe's passwd** Enter new UNIX password: ** you enter new jenkins passwd** Retype new UNIX password: ** you enter new jenkins passwd** passwd: password updated successfully </code></pre> <p><strong>Alternative: login as jenkins without his password</strong></p> <p>Alternatively, again using sudo from a suitable other account, you can login as jenkins without being asked for his password:</p> <pre><code>sudo su - jenkins </code></pre> <p><strong>An aside: Avoiding password prompt confusion</strong></p> <p>Before issuing <code>sudo passwd jenkins</code>, we might first like to authenticate separately with sudo to avoid confusion around the question "whose password am I being asked for, now?".</p> <pre><code>sudo -v sudo passwd jenkins </code></pre> <p>After a successful authentication by sudo, there is a window (e.g. 15 minutes) where we won't be prompted to authenticate again. (Note that you can immediately invalidate (kill) this session with <code>sudo -k</code>, if you want to experiment.)</p> <p><strong>The promised strict answer</strong></p> <pre><code>sudo -u jenkins ssh-keygen </code></pre> <p>Then use cat to view the contents of the public key to be passed to github (but the path is only an example):</p> <pre><code> sudo cat ~jenkins/.ssh/id_rsa.pub </code></pre> <p>The exact location and name of the public key file depends on what you entered to the prompts of ssh-keygen, above. I've used a shortcut to jenkins' home dir, <code>~jenkins</code>.</p> <p><strong>Related Links</strong></p> <ul> <li><a href="http://manpages.ubuntu.com/manpages/lucid/en/man8/sudo.8.html" rel="noreferrer">sudo manpage</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload