0 votes
1 view
in AWS by (9.2k points)

This issue has been bugging me for the past several days.

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.

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.

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.

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.

Here's my dilemma:

/$ whereis 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

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.

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.

Here are the id's of the AMI's I used:



I also tried a third AMI later that also had LAMP installed... I couldn't even get into that one at all.

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.

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?

Any help would be greatly appreciated...

1 Answer

+1 vote
by (18.5k points)
selected by
Best answer

WinSCP is a file transfer client. What you need is an SSH client. Use Putty and you won't face this issue again.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !