From: ahoward Date: 2003-08-29T07:36:22+09:00 Subject: Re: Password: On Fri, 29 Aug 2003, mgarriss wrote: > mgarriss wrote: > > > Any easy and elegant way to do the 'no output to the screen' thing for > > entering passwords. I don't want to have to use ncurses. Also, can I > > force stdin to be a tty like 'su' does? > > > > Michael > > > I should mention that I'm on a GNU/Linux but it'd be nice to have a > cross-platform solution to this. ~ > cat ./password.rb require 'password' # get from the RAA def password password = Password.get('Password') if block_given? # block form is safer! begin yield password ensure password.replace '' end else # you should delete/replace this so strace can't show it! return password end end password do |pswd| puts pswd end puts password() ~ > ruby ./password.rb Password: foobar Password: barfoo -a ==================================== | Ara Howard | NOAA Forecast Systems Laboratory | Information and Technology Services | Data Systems Group | R/FST 325 Broadway | Boulder, CO 80305-3328 | Email: ara.t.howard@noaa.gov | Phone: 303-497-7238 | Fax: 303-497-7259 | ~ > ruby -e 'p(%.\x2d\x29..intern)' ====================================