create no-login user using chef -


i read https://docs.chef.io/resource_user.html , looks creating system account. want create user running process no login option. right now, using execute block in chef recipe. not great fan of execute block. there way can replace code?

execute 'create user service'    command -c "this account testing something" -s /sbin/nologin -g 'mygroup' -r my_user' end 

-s /sbin/nologin on command same specifying shell "/sbin/nologin" in user resource.

the user resource create users, create system user if set system property true.

so chef user resource command line is:

user 'my_user' # user name in command   action :create # default action, omitted, better precise   shell '/sbin/nologin'   gid 'mygroup' # -g in execute   comment 'this account testing somethin' # -c in execute   system true # match -r in execute   manage_home false # avoid creating home directory, omit if wish anyway end 

the nologin executable can replaced false. find correct path distro use which nologin.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

android - Go back to previous fragment -