title: How Can I Enable Root SSH Access in An Amazon EC2 Instance?
body: <p>This issue has been bugging me for the past several days.</p>
  
  <p>I've been working on setting up a LAMP Server on Amazon EC2. The main issue is that I'm writing an application for a client that requires a lot of high-end processing, and Amazon EC2 seemed like a good choice.</p>
  
  <p>Initially I started off with a basic AMI which really didn't have anything. I tried using root access to log into SSH (using WinSCP) and I was told to use ec2-user.</p>
  
  <p>I tried using ec2-user, and I was able to log in. However, I still didn't have root access and couldn't install apache. I did some reason and I found out about the "sudo" command, and pretty much every article I read on this issue said to either use root access, or log into ec2-user and user sudo.</p>
  
  <p>I have since tried again with a different AMI where LAMP was already installed. I was able to get it working, set up a database and start running a website off of it. However, I still needed to install some extensions. Namely, an API I'm trying to use for this application requires SOAP to be installed.</p>
  
  <p>Here's my dilemma:</p>
  
  <pre><code>/$ whereis soap
  soap:
  /$ whereis yum
  yum: /usr/bin/yum /etc/yum /etc/yum.conf /usr/share/man/man8/yum.8.gz
  /$ yum install php-soap
  Loaded plugins: fastestmirror, priorities, security
  You need to be root to perform this command.
  /$ sudo yum install php-soap
  sudo: sorry, you must have a tty to run sudo
  
  Command 'sudo yum install php-soap' failed with return code 1 and error message sudo: sorry, you must have a tty to run sudo
  </code></pre>
  
  <p>I can't use yum because I don't have root access, and whenever I log into root it either tells me to use ec2-user or provide a password I don't have. The other alternative was to use sudo to make ec2-user act like root, but I always get the error 'sorry, you must have a tty to run sudo.' I've ran that error message online and that it seems I need to add a user to sudoers... which I can't do without root access.</p>
  
  <p>This exact same issue plagued me on two separate AMI's. On the first I just received a message saying I had to log in as ec2-user (and I must have a tty to run sudo), while the second (with LAMP installed) required me to enter a password for root, and for user I got the same sudo error.</p>
  
  <p>Here are the id's of the AMI's I used:</p>
  
  <pre><code>ami-8c1fece5
  ami-6ae81503
  </code></pre>
  
  <p>I also tried a third AMI later that also had LAMP installed... I couldn't even get into that one at all.</p>
  
  <p>I did download my SSH key and used PuttyGen to convert it to a ppk file. I can log in successfully as ec2-user, but I cannot gain root access anywhere.</p>
  
  <p>I have been looking around quite a bit for help on this, but every article I've read assumes that the user either has root access available or has sudo available on ec2-user. I don't have either. Is it just that I need a new image?</p>
  
  <p>Any help would be greatly appreciated...</p>