zoukankan      html  css  js  c++  java
  • Jenkins User on Apt-Get Install Installation

    转自:http://stackoverflow.com/questions/6234016/jenkins-user-on-apt-get-install-installation

    QUESTION:

    I just installed Jenkins on my Ubuntu server via the debian installation steps (using apt-get install). I want my build to pull from a private git repository on GitHub. With that, I need to use SSH access to get to my repository.

    Most of my search results have just said to login as the Jenkins user and generate an SSH key for my GitHub account, but installing through the debian package manager, I don't have a password for the Jenkins user.

    So how do I generate an SSH key for my Jenkins server to use?

    ANSWER:

    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.

    Change jenkins' password without knowing it

    From any account which has sudo permissions, you can reset jenkins' password to something of your choosing:

    sudo passwd jenkins
    

    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.

    If your user with sudo rights is called joe, here's how a session might look:

    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
    

    Alternative: login as jenkins without his password

    Alternatively, again using sudo from a suitable other account, you can login as jenkins without being asked for his password:

    sudo su - jenkins
    

    An aside: Avoiding password prompt confusion

    Before issuing sudo passwd jenkins, we might first like to authenticate separately with sudo to avoid confusion around the question "whose password am I being asked for, now?".

    sudo -v
    sudo passwd jenkins
    

    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 sudo -k, if you want to experiment.)

    The promised strict answer

    sudo -u jenkins ssh-keygen
    

    Then use cat to view the contents of the public key to be passed to github (but the path is only an example):

      sudo cat ~jenkins/.ssh/id_rsa.pub
    

    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, ~jenkins.

  • 相关阅读:
    HashMap(HashSet)的实现
    C/C++ 安全编码 —— 指针与内存
    AlexNet神经网络结构
    查看,修改动态组成员/通讯组
    刷新已禁用用户邮箱状态
    监控DAG状态
    AD诊断命令
    PowerShell管理Exchange
    TCP连接(Time_Wait、Close_Wait)说明
    IIS配置(安装IIS、.Net、更改IIS Log目录位置)
  • 原文地址:https://www.cnblogs.com/rosepotato/p/3738950.html
Copyright © 2011-2022 走看看