IoT requires data processing, which is provided by the cloud and fog computing. Fog computing shifts centralized data processing from the cloud data center to the edge, thereby supporting faster response due to reduced communication latencies. Its distributed architecture raises security and privacy issues; some are inherited from the cloud, IoT, and network whereas others are unique. Securing fog computing is equally important as securing cloud computing and IoT infrastructure. Security solutions used for cloud computing and IoT are similar but are not directly applicable in fog scenarios. Machine learning techniques are useful in security such as anomaly detection, intrusion detection, etc. So, to provide a systematic study, the chapter will cover fog computing architecture, parallel technologies, security requirements attacks, and security solutions with a special focus on machine learning techniques.