0

I want to create new ssh user that can access instance using cloudformation template userdata. i am using this json script

"sudo adduser jenkins-user --disabled-password\n",
"sudo su - jenkins-user\n",
"\n", 
"mkdir .ssh\n",
"chmod 700 .ssh\n",
"touch .ssh/authorized_keys\n", 
"chmod 600 authorized_keys\n",
"cat >> /home/jenkins-user/.ssh/authorized_keys << end\n",
"ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCKoORk6rbM4/0eDO0zBMWshXeibiuPQCP2KMl0fbyJTp9nCNngDG3qrIYBvU4TdOCXF\n", "\n",
"end\n"

and i am getting this error when i check cloud-init-output.log

adduser jenkins-user --disabled-password
Adding user `jenkins-user' ...
Adding new group `jenkins-user' (1001) ...
Adding new user `jenkins-user' (1001) with group `jenkins-user' ...
Creating home directory `/home/jenkins-user' ...
Copying files from `/etc/skel' ...
Changing the user information for jenkins-user
Enter the new value, or press ENTER for the default
Full Name []:   
Room Number []:     
Work Phone []:  
Home Phone []:  
Other []: Use of uninitialized value $answer in chop at /usr/sbin/adduser line 589.
Use of uninitialized value $answer in pattern match (m//) at /usr/sbin/adduser line 590.
Is the information correct? [Y/n] sudo su - jenkins-user

can someone help me with this?

strongjz
  • 832
  • 4
  • 7
Nani
  • 165
  • 1
  • 2
  • 7

1 Answers1

0

adduser is interactive, switch to useradd.

useradd is native binary compiled with the system. But, adduser is a perl script which uses useradd binary in back-end.

adduser is more user friendly and interactive than its back-end useradd. There's no difference in features provided.

https://superuser.com/questions/547966/whats-the-difference-between-adduser-and-useradd

strongjz
  • 832
  • 4
  • 7