Selective transport of ions through nanometer-sized pores is fundamental to cell biology and central to many technological processes such as water desalination and electrical energy storage. Conventional methods for generating ion selectivity include placement of fixed electrical charges at the inner surface of a nanopore through either point mutations in a protein pore or chemical treatment of a solid-state nanopore surface, with each nanopore type requiring a custom approach. Here, we describe a general method for transforming a nanoscale pore into a highly selective, anion-conducting channel capable of generating a giant electro-osmotic effect. Our molecular dynamics simulations and reverse potential measurements show that exposure of a biological nanopore to high concentrations of guanidinium chloride renders the nanopore surface positively charged due to transient binding of guanidinium cations to the protein surface. A comparison of four biological nanopores reveals the relationship between ion selectivity, nanopore shape, composition of the nanopore surface, and electro-osmotic flow. Remarkably, guanidinium ions are also found to produce anion selectivity and a giant electro-osmotic flow in solid-state nanopores via the same mechanism. Our sticky-ion approach to generate electro-osmotic flow can have numerous applications in controlling molecular transport at the nanoscale and for detection, identification, and sequencing of individual proteins.