[Ilugc] standard in must be a tty -- why?

  • From: mssnlayam@xxxxxxxxxxxxxxx (Suriya Narayanan M S)
  • Date: Sun, 1 Sep 2002 07:46:44 +0530

On Saturday 31 August 2002 07:26 pm, you wrote:
  > For your reference here is the sequence of commands been executed in my
  > script(example):
  > 
  > $ ssh my_user@my_host tar -zcf mytar.tgz my_dirs
  > $ scp my_user@my_host:mytar.tgz /tmp/
  > $ su root -c "mount -t ext2 -v /dev/hda6 /mnt/part6; sleep 3; mv mytar.tgz 
  > my_partion_dir -v; umount -v /mnt/part6"
  > 
  > I suppose the problem is while doing su. But i am unable to narrow down 
  > the same. Hope to get some lights.

The problem is with su. When running su, the standard
input must be a tty (to read the password). su cannot receive
input from a pipe, or redirected file. Also, there is no mention
in the manual about getting the password from a file.

Regards,
Suriya Narayanan M S
-- 
Guru Brahma Gurur Vishnu
Gurur Dhevo Maheshwaraha
Gurur Saakshaath Parabramha
Thasmai Shree Gurave Namaha


Other related posts: