美文网首页Jenkins
Jenkins误删admin补救

Jenkins误删admin补救

作者: 悄然林静 | 来源:发表于2020-10-22 14:55 被阅读0次

背景

Jenkins通常使用插件Role-based Authorization Strategy管理用户权限,

问题描述

手贱误删了自己的admin用户

误删admin

页面各种点击、搜索均无响应,

页面无响应

尝试登录账号,报403错误

login报403错误

补救措施

Jenkins的配置信息存放在工作空间/config.xml中,下面是其中关于Role-based Authorization Strategy插件的内容:

    <useSecurity>true</useSecurity>
    <authorizationStrategy class="com.michelin.cio.hudson.plugins.rolestrategy.RoleBasedAuthorizationStrategy">
        <roleMap type="globalRoles">
            <role name="admin" pattern=".*">
                <permissions>
                    <permission>hudson.model.Hudson.Read</permission>
                    <permission>hudson.model.View.Delete</permission>
                    <permission>hudson.model.Computer.Connect</permission>
                    <permission>hudson.model.Item.Create</permission>
                    <permission>hudson.model.Item.Workspace</permission>
                    <permission>hudson.model.Computer.Create</permission>
                    <permission>hudson.model.View.Configure</permission>
                    <permission>hudson.model.Computer.Provision</permission>
                    <permission>hudson.model.Computer.Build</permission>
                    <permission>hudson.model.Item.Configure</permission>
                    <permission>hudson.model.View.Read</permission>
                    <permission>hudson.model.View.Create</permission>
                    <permission>hudson.model.Hudson.Administer</permission>
                    <permission>hudson.model.Item.Cancel</permission>
                    <permission>hudson.model.Item.Delete</permission>
                    <permission>hudson.model.Item.Read</permission>
                    <permission>hudson.model.Computer.Configure</permission>
                    <permission>hudson.model.Computer.Delete</permission>
                    <permission>hudson.model.Item.Build</permission>
                    <permission>hudson.model.Computer.Disconnect</permission>
                    <permission>hudson.model.Item.Discover</permission>
                </permissions>
                <assignedSIDs>
                    <sid>anonymous</sid>
                </assignedSIDs>
            </role>
            <role name="ops" pattern=".*">
                <permissions>
                    <permission>hudson.model.Hudson.Read</permission>
                    <permission>hudson.model.View.Delete</permission>
                    <permission>hudson.model.Item.Create</permission>
                    <permission>hudson.model.Item.Workspace</permission>
                    <permission>hudson.model.View.Configure</permission>
                    <permission>hudson.model.Item.Configure</permission>
                    <permission>hudson.model.View.Read</permission>
                    <permission>hudson.model.View.Create</permission>
                    <permission>hudson.model.Item.Cancel</permission>
                    <permission>hudson.model.Item.Delete</permission>
                    <permission>hudson.model.Item.Read</permission>
                    <permission>hudson.model.Item.Build</permission>
                    <permission>hudson.model.Item.Discover</permission>
                </permissions>
                <assignedSIDs/>
            </role>
            <role name="other" pattern=".*">
                <permissions>
                    <permission>hudson.model.Hudson.Read</permission>
                </permissions>
                <assignedSIDs/>
            </role>
        </roleMap>
        <roleMap type="slaveRoles"/>
        <roleMap type="projectRoles"/>
    </authorizationStrategy>

只要将相应的roleMap下的role添加回来,并重启Jenkins服务即可。

相关文章

网友评论

    本文标题:Jenkins误删admin补救

    本文链接:https://www.haomeiwen.com/subject/ieoumktx.html