We propose a universal scheme for the probabilistic generation of an arbitrary multimode entangled state of light with finite expansion in Fock basis. The suggested setup involves passive linear optics, single photon sources, strong coherent laser beams, and photodetectors with single-photon resolution. The efficiency of this setup may be greatly enhanced if, in addition, a quantum memory is available.