0

I am writing a shell script that will create a user that I will use for deployments. I want to add that user to be able to use sudo without a password. How can I create this user from a shell script or from the command line?

This is what I have so far (this script is run as the root user):

# create user
useradd deploy -m -s /bin/bash

# copy authorized keys
mkdir -p /home/deploy/.ssh
cat ~/.ssh/authorized_keys > /home/deploy/.ssh/authorized_keys
chown -R deploy:deploy /home/deploy/.ssh
Andrew
  • 299

0 Answers0