Jenkins配置问题咨询:用户创建、登录及日志查看
Jenkins新手配置问题解决方案
Hey Rocky, let's work through each of your Jenkins issues step by step – I remember hitting similar roadblocks when I first started, so I know how confusing this can be!
1. 仪表盘无创建用户选项的问题
If you already created an admin user during initialization, the user management entry isn't on the main dashboard by default. Here's how to find it (and fix it if it's missing):
- If you can still access Jenkins with a privileged account: Navigate to Manage Jenkins > Manage Users – this is where you'll find the option to create new users.
- If you can't log in at all (ties into your second issue): You'll need to temporarily disable security to regain access:
- Locate your Jenkins home directory's
config.xmlfile (I'll cover where this is in the next section). - Find the line
<useSecurity>true</useSecurity>and change it to<useSecurity>false</useSecurity>. - Restart your Tomcat server. Once Jenkins reloads, you'll be able to access it without login prompts. Then head back to Manage Jenkins > Configure Global Security to re-enable security and set up user management properly.
- Locate your Jenkins home directory's
2. Jenkins用户凭证的存储位置
Jenkins stores user-related data in two key places within your Jenkins home directory:
- Local user accounts: Look for the
usersfolder. Each user has their own subfolder named after their username (e.g.,users/admin/). Inside each folder, theconfig.xmlfile contains the user's details, including their encrypted password hash. - Global credentials (like Git/Server credentials): These are stored in the root of the Jenkins home directory in the
credentials.xmlfile.
To find your Jenkins home directory:
- On Linux/macOS: It's usually
~/.jenkinsby default. - On Windows: Check
C:\Users\[Your Username]\.jenkins. - If you can access Jenkins (even temporarily), go to Manage Jenkins > System Configuration – the path is listed under "Jenkins home directory".
3. 查看Jenkins日志及调试登录失败
Where to find logs
You have two main log sources to check:
- Tomcat server logs: These live in your Tomcat installation's
logsfolder. On Linux/macOS, the most useful one iscatalina.out; on Windows, look forlocalhost.logorlocalhost_access_log.*.txt. These logs capture all output from Jenkins running inside Tomcat. - Jenkins internal logs: If you can access the Jenkins dashboard, go to Manage Jenkins > System Log. You can filter logs by level (like ERROR or WARNING) to zero in on login issues.
Debugging login failures
- Check Tomcat logs first: Look for lines containing keywords like "Authentication failed" or "User not found" – these will tell you exactly why the login is failing (e.g., wrong password, disabled user, mismatched auth method).
- Reset admin password if needed: If you forgot the admin password, edit the
users/admin/config.xmlfile in your Jenkins home directory:- Find the
<passwordHash>line and replace its value with this default hash:#jbcrypt:$2a$10$DdaWzN64JgUtLdvxWIflcuQu2fgrrMSAMabF5TSrGK5nXitqK9ZMS(this corresponds to the passwordadmin). - Save the file and restart Tomcat – you'll now be able to log in with
admin/admin.
- Find the
- Verify security settings: If you recently changed the authentication method (e.g., switched to LDAP), make sure your local admin user is still allowed to log in. Head to Manage Jenkins > Configure Global Security to check the "Security Realm" setting.
内容的提问来源于stack exchange,提问作者Rocky
相关产品推荐
相关产品推荐

