1

My server was having error due to high traffic and it showed this message often when I access the website

Error: EMFILE: too many open files, open '/home/ubuntu/chat2/public/style.css'
    at Error (native)

To fix this, I googled and tried to increase the Ulimit in Ubuntu.

Recently I changed the following files

sysctl.conf 

as I followed this tutorial http://ithubinfo.blogspot.in/2013/07/how-to-increase-ulimit-open-file-and.html

and also changed

/etc/security/limits.conf

After I did that, I logged out of my ssh and then tried logging in and since then I am unable to get in.

It logs in and then tell me that Connection to (server ip) closed.

See enter image description here

How can I get access to my terminal back and/or restore my limits.conf and sysctl.conf ?

UPDATE:

i tried accessing it via FTP File zilla and it gives error "Unexpected end of file SFTP". enter image description here

How do I edit those files again without terminal access?

Faizan
  • 111
  • 3
  • There is something in your server that initially has too many open files. It might be compromised, or there might be misconfigured software. You should have fixed the root cause, not alleviate symptoms.. – Tero Kilkanen Jul 28 '16 at 16:29
  • 1
    what do the server logs say? – Jakuje Jul 28 '16 at 21:19
  • @TeroKilkanen How can i get access to ssh and sftp back? – Faizan Jul 29 '16 at 11:19
  • @Jakuje I can't access my EC2 server ubunut, as I can't get into via SSH or via SFTP. How can I get to see the logs? Is there any way to see the logs from AWS online console? – Faizan Jul 29 '16 at 11:21
  • 1
    Stop (NOT terminate) the instance and start another one with a officially provided AMI from Ubuntu or so. Attach the EBS volume which is the root volume from your currently running instance to the new instance and mount it. Now you can access all files and modify them. Afterwards you can reattach the EBS volume back and start your instance again. – Osterjour Aug 03 '16 at 13:43

0 Answers0