Lithium-sulfur batteries are considered to be the most promising energy-storage solution to meet the future energy demand. However, both anode and cathode suffer from fatal drawbacks which hinder the practical application of Li-S batteries. Especially in the anode, dendrite growth, infinite volume expansion and unstable solid electrolyte interphase greatly trigger the safety hazard and capacity fading. Herein we provide a facile approach via designing a nonwoven fiber separator of polyethyleneimine-grafted polyacrylonitrile nanofibers to regulate lithium deposition and mitigate the shuttle of lithium polysulfides. Through the precise process of electrospinning, the diameter of PAN fibers could be decreased to hundreds of nanometers, which provides uniform pathway for lithium ions transportation. The branched PEI group effectively increase the nitrogen content of the whole separator, which could chemically anchor Li ions. In comparison with the traditional PE/PP separator the PEI-g-PAN separator possesses better affinity and larger uptake of ether-based electrolyte. As a result, the lithium metal anode with PEI-g-PAN separator show better cycling stability and longer lifespan with a high Coulombic efficiency of 97% after 200th cycle. Even more noteworthy is that the PEI functional group with positive charge could catch the troublesome polysulfides during charge/discharge of the Li-S batteries. Consequently, this bifunctional PEI-g-PAN separator is beneficial to both anode and cathode of Li-S batteries, and reveal a new avenue for the next-generation energy storage.