简体   繁体   English

如何向 Jenkins 添加用户名和密码?

[英]How can I add a username and password to Jenkins?

When I go to mydomain.example:8080 there is no authorization mechanism by default.当我转到mydomain.example:8080时,默认情况下没有授权机制。 I have had look at the configuration area but cannot find anywhere to add a basic username and password我查看了配置区域,但找不到添加基本用户名和密码的地方

Go to Manage Jenkins > Configure Global Security and select the Enable Security checkbox.转到管理 Jenkins > 配置全局安全并选中启用安全复选框。

For the basic username/password authentication, I would recommend selecting Jenkins Own User Database for the security realm and then selecting Logged in Users can do anything or a matrix based strategy (in case when you have multiple users with different permissions) for the Authorization .对于基本的用户名/密码身份验证,我建议为安全领域选择Jenkins Own User Database ,然后为Authorization选择登录用户可以做任何事情或基于矩阵的策略(如果您有多个具有不同权限的用户)。

Assuming you have Manage Jenkins > Configure Global Security > Enable Security and Jenkins Own User Database checked you would go to:假设您已选中Manage Jenkins > Configure Global Security > Enable SecurityJenkins Own User Database ,您将转到:

  • Manage Jenkins > Manage Users > Create User管理 Jenkins > 管理用户 > 创建用户
  • Try deleting the .jenkins folder from your system which is located ate the below path.尝试从位于以下路径的系统中删除 .jenkins 文件夹。 C:\Users\"Your PC Name"\.jenkins

  • Now download a fresh and a stable version of .war file from official website of jenkins.现在从 jenkins 官网下载一个新的稳定版本的 .war 文件。 For eg.例如。 2.1 and follow the steps to install. 2.1并按照步骤安装。

  • You will be able to do via this method您将可以通过此方法进行

You need to Enable security and set the security realm on the Configure Global Security page (see:Standard Security Setup ) and choose the appropriate Authorization method ( Security Realm ).您需要在配置全局安全页面上启用安全并设置安全领域(请参阅:标准安全设置)并选择适当的授权方法(安全领域)。

Jenkins Security Realm,Hudson 自己的用户数据库

Depending on your selection, create the user using appropriate method.根据您的选择,使用适当的方法创建用户。 Recommended method is to select Jenkins' own user database and tick Allow users to sign up , hit Save button, then you should be able to create user from the Jenkins interface.推荐的方法是选择Jenkins 自己的用户数据库并勾选Allow users to sign up ,点击 Save 按钮,然后您应该可以从 Jenkins 界面创建用户。 Otherwise if you've chosen external database, you need to create the user there (eg if it's Unix database, use credentials of existing Linux/Unix users or create a standard user using shell interface).否则,如果您选择了外部数据库,则需要在那里创建用户(例如,如果它是 Unix 数据库,则使用现有 Linux/Unix 用户的凭据或使用 shell 接口创建标准用户)。

See also: Creating user in Jenkins via API另请参阅:通过 API 在 Jenkins 中创建用户

If installed as an admin, use:如果以管理员身份安装,请使用:

uname - admin
pw - the passkey that was generated during installation

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM