-2

I am doing this using fabric (python):

  1. Login as root to a brand new Centos 6.5 box from linode.com
  2. Run the following script

The script:

#!/bin/bash
yum -y update
adduser shortfellow
echo "shortfellow ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
echo 'Defaults:shortfellow !requiretty' >> /etc/sudoers
/sbin/mkhomedir_helper shortfellow
mkdir -p /home/shortfellow/.ssh
echo "<my ssh public key>" >> /home/shortfellow/.ssh/authorized_keys
chmod -R 700 /home/shortfellow/.ssh
chown -R shortfellow:shortfellow /home/shortfellow/.ssh
su - shortfellow
exit

The problem:

I can not log into the server with the new server with given username(shortfellow) for a few attempts. I have added ssh keys to ssh-agent. It works after I try to login multiple times, but I can not understand why that would be the case.

Any help is appreciated.

Morgan
  • 4,143
  • 27
  • 35
Ranjith Ramachandra
  • 10,399
  • 14
  • 59
  • 96

1 Answers1

0

You might want to use single quotes when echoing things like ssh keys. If there are any special characters that would be bash variables or similar they could be being expanded.

Morgan
  • 4,143
  • 27
  • 35