-
-
Save ubergesundheit/8517566 to your computer and use it in GitHub Desktop.
modify for creating ssh key for root
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
define :generate_ssh_keys, :user_account => nil do | |
username = params[:user_account] | |
raise ":user_account should be provided." if username.nil? | |
Chef::Log.debug("generate ssh key for #{username}.") | |
execute "generate ssh key for #{username}." do | |
user username | |
creates "#{(username != 'root' ? '/home' : '')}/#{username}/.ssh/id_rsa.pub" | |
command "ssh-keygen -t rsa -q -f #{(username != 'root' ? '/home' : '')}/#{username}/.ssh/id_rsa -P \"\"" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment