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

  • From: bhuvanbk@xxxxxxxxxxxxx (Bhuvan A)
  • Date: Mon, 2 Sep 2002 10:57:35 +0530 (IST)

  > 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.


But anyway i am not using pipe or redirection in my command. BTW, in
normal case it wont query for password, since the user is belong to wheel
group and all the users of wheel group are trusted. Again, if i run my
script from command prompt it runs fine as it is expected to (it wont
query for password). The problem is while running in crond. Any other
clue?

regards,
bhuvaneswaran



Other related posts: