Jenkins用户在macOS更新后不见了

Jenkins用户在macOS更新后不见了,第1张

Jenkins用户在macOS更新后不见了

通过从Jenkins安装中提取创建用户的脚本命令,我设法重新创建了该用户。我特别运行了此脚本:

JENKINS_HOMEDIR="/Users/Shared/Jenkins"DEFAULTS_PLIST="/Library/Preferences/org.jenkins-ci.plist"if dscl . -list /Users/jenkins; then    echo 'jenkins user already exists, attempting to change the shell to /bin/bash'    # Will fail if UserShell is not /usr/bin/false, but that's ok.    # Then we will assume an admin has changed it.    dscl . -change /Users/jenkins UserShell /usr/bin/false /bin/bashelse    echo 'No jenkins user found, creating jenkins user and group'# Find free uid under 500    uid=$(dscl . -list /Users uid | sort -nrk 2 | awk ' < 500 {print  + 1; exit 0}')    if [ $uid -eq 500 ]; then        echo 'ERROR: All system uids are in use!'        exit 1    fi    echo "Using uid $uid for jenkins"    gid=$uid    while dscl -search /Groups gid $gid | grep -q $gid; do        echo "gid $gid is not free, trying next"        gid=$(($gid + 1))    done    echo "Using gid $gid for jenkins"    dscl . -create /Groups/jenkins PrimaryGroupID $gid    dscl . -create /Users/jenkins UserShell /bin/bash    dscl . -create /Users/jenkins Password '*'    dscl . -create /Users/jenkins UniqueID $uid    dscl . -create /Users/jenkins PrimaryGroupID $gid    dscl . -create /Users/jenkins NFSHomeDirectory "$JENKINS_HOMEDIR"    dscl . -append /Groups/jenkins GroupMembership jenkinsfi# identify the real default group name for user jenkinsgroupid=`dscl . read /Users/jenkins PrimaryGroupID | awk '{print }'`gname=`id -n -g $groupid`echo "Using jenkins:${gname} as file owner and group for jenkins daemon files"find "$JENKINS_HOMEDIR" ( -not -user jenkins -or -not -group ${gname} ) -print0 | xargs -0 chown jenkins:${gname}# Add defaults for heap sizingarch=$(uname -m)if [ $arch = 'x86_64' ]; then    defaults write $DEFAULTS_PLIST heapSize 512m    defaults write $DEFAULTS_PLIST permGen 512m    defaults write $DEFAULTS_PLIST minHeapSize 256m    defaults write $DEFAULTS_PLIST minPermGen 256melse    # i386    defaults write $DEFAULTS_PLIST heapSize 128m    defaults write $DEFAULTS_PLIST permGen 128m    defaults write $DEFAULTS_PLIST minHeapSize 64m    defaults write $DEFAULTS_PLIST minPermGen 64m    fidefaults write $DEFAULTS_PLIST httpPort 8080# Set tmpdirJENKINS_TMPDIR="$JENKINS_HOMEDIR/tmp"defaults write $DEFAULTS_PLIST tmpdir $JENKINS_TMPDIRmkdir -p $JENKINS_TMPDIRchown jenkins:${gname} $JENKINS_TMPDIR# Create log directory, which can be written by Jenkins daemonmkdir -p /var/log/jenkinschown jenkins:${gname} /var/log/jenkins


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5615070.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-15
下一篇 2022-12-15

发表评论

登录后才能评论

评论列表(0条)

保存