Quantcast
Viewing all articles
Browse latest Browse all 2

useradd from jenkins user error: useradd: cannot lock /etc/passwd; try again later

I run a shell script (Centos 6.7) from jenkins containing this command, in order import root environment:

 env -i `cat /home/admin/root_environment.sh` /home/admin/create_user.sh

The root_environment was generated with

 env > root_environment.sh

the script create_user.sh contains

/usr/sbin/useradd -p "pass" "username"

Jenkins is running with its own jenkins user. The script create_user.sh is working correctly if I run it as root, however, running from jenkins I get:

 useradd: cannot lock /etc/passwd; try again later

Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>