[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help on /dev/tty and su -c



On Wed, 14 Mar 2012 18:24:34 -0500 Bedwell, Jordon wrote:

> Hey Francesco,

Hi Jordon,
thanks for your reply!

> 
> Here is the code you are seeking.  Feel free to send me a personal
> email if you need more help.
> 
> #!/home/jordon/.ruby/1.9.3p125/bin/ruby
> # Here it is in gist form: https://gist.github.com/2040324
> $stdin.each.each { |line| $stdout.puts "Item: #{line}" }
> $stdin = IO.new(IO.sysopen('/dev/tty', 'r'), 'r')
> $stdout.print 'What is your name: '
> $stdout.puts 'Well, hello there ' + $stdin.gets.chomp + ', it
> certainly is nice to meet you.'

Mmmmh, it does not work for me:

$ cat input.txt | ./test_jordon.rb 
Item: one
Item: two
Item: three
What is your name: Francesco
Well, hello there Francesco, it
certainly is nice to meet you.
$ su -c "cat input.txt | ./test_jordon.rb"
Password: 
Item: one
Item: two
Item: three
./test_jordon.rb:4:in `sysopen': No such device or address - /dev/tty (Errno::ENXIO)
        from ./test_jordon.rb:4

Did you test it with package login/1:4.1.5-1 or with an older version?

Please note that the security fix for su that we are talking about has
been applied to Debian package login/1:4.1.5-1 ...



-- 
 http://www.inventati.org/frx/frx-gpg-key-transition-2010.txt
 New GnuPG key, see the transition document!
..................................................... Francesco Poli .
 GnuPG key fpr == CA01 1147 9CD2 EFDF FB82  3925 3E1C 27E1 1F69 BFFE

Attachment: pgpDRspeAumxK.pgp
Description: PGP signature


Reply to: