What is meant by the devils being chained up in Ramadan?
Question

What do you say about the devils being chained up in Ramadan?.
Praise be to Allah.Al-Bukhaari (1899) and Muslim (1079) narrated from Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings of Allah be upon him) said: “When Ramadan comes, the gates of Paradise are opened, the gates of Hell are closed, and the devils are chained up.” 
The scholars differed as to the meaning of the devils being chained up in Ramadan. 
Al-Haafiz ibn Hajar said, quoting al-Haleemi: It may be interpreted at meaning that the devils are not able to tempt the Muslims as they are at other times because they are busy with the fast which controls their desires, and with reading Quran and dhikr (remembrance of Allah). Another scholar – someone other than al-Haleemi – said that what is meant by the devils is some of them, namely the maarids (strong devils), who are chained up. 
‘Iyaad said: it may be interpreted in a literal sense, and that is as a sign to the angels that the month has begun, and in veneration of its sanctity, and so as to prevent the devils from harming the Muslims. And it may be interpreted as referring to the great amount of reward and forgiveness, and that the devils tempt people less, so it is as if they are chained up. This second interpretation is supported by the fact that according to a report narrated by Yoonus from Ibn Shihaab which is recorded by Muslim it says “the gates of mercy are opened”. The chaining up of the devils may also be understood as a metaphor for them being unable to tempt people and make their whims and desires attractive to them. Al-Zayn ibn al-Muneer said: The first view is most likely to be correct, and there is no need to try to understand it in anything other than the literal sense."(Fath al-Bari, 4/114). 
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) was asked about the words of the Prophet (peace and blessings of Allah be upon him) “and the devils are chained up,” – yet we still see people suffering from epilepsy during the day in Ramadan, so how can the devils be chained up when some people are suffering epileptic fits? 
He replied: In some versions of the hadith it says “and the strong devils (maarids) are chained up” – this is narrated by al-Nasaa’i. This hadith is speaking of matters of the unseen, so we have to accept it and not discuss it any further. This is safer for a person’s religious commitment. Hence when ‘Abd-Allah, the son of Imam Ahmad ibn Hanbal said to his father, “Some people suffer epileptics fits during the day in Ramadan,” the Imam said: “This is what the hadith says and we do not discuss this.” 
Moreover it seems that what is meant by their being chained up is that they are prevented from tempting people, based on the fact that there is a great deal of goodness and many people turn to Allah during Ramadan. 
Majmoo’ al-Fataawa, 20. 
Based on this, the chaining up of the devils is something that happens in a real sense, about which Allah knows best. This does not mean that evil things do not happen or that people do not commit sin. And Allah knows best. 
See also question no.  12653.