SSH / sFTP return Connection refused

0

I change the permission with SSH (very simple just "chown -R ec2-user:apache /var/www/html/xxxxx/xxxx/xxx"), the SSH reject my connection and ssh: connect to host xxx.xxx.xxx.xxx port 22: Connection refused... After that I check and reboot the EC2 but not effective...

What can I do...

질문됨 일 년 전349회 조회
1개 답변
0

In accordance with AWS, Apache httpd serves files that are kept in a directory called the Apache document root. The Amazon Linux Apache document root is /var/www/html, which by default is owned by root. (Your case may be /var/www/html/xxxx/public_html where you have made directory) To allow the ec2-user account to manipulate files in this directory, you must modify the ownership and permissions of the directory. There are a few ways to perform this task. AWS tutorial suggests, you add ec2-user to the apache group, to give apache group ownership of the /var/www directory and assign write permissions to the group.

Add your user (ec2-user) to the apachegroup

$sudo usermod -a -G apache ec2-user

Change the group ownership of /var/www and its contents to the apache group.

$sudo chown -R ec2-user:apache /var/www (Do not forget to add your directories, /var/www/html/xxxxx/xxxx/xxx)

If you are using the SSH client (Linux, Ubuntu) and downloed the file and copied in the Downloaded folder.

$chmod 400 x.pem (x.pem, replace with your pem file)

If your subnet is configured to get public IP automatically, then every reboot you get new IP address and as such your public dns changes.

If you are using EC2 Instance connect, please check your security group.

Please navigate this link:

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-lamp-amazon-linux-2.html

Please let me know, I am also learning.

답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠