Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using STAF to automate db2 interface testing with our product. I am able to run the command using su - db2inst1 -c "/home/db2inst1/sqllib/bin/db2 list database directory" but when I try the same command with the staf interface I am getting the error:

standard in must be a tty

I commented the "Defaults requiretty" in /etc/sudoers, but still have the same issue.

share|improve this question
add comment

2 Answers

Drop the lone dash (-) in your su command. That triggers su to ask for a login shell. A tty might be required by some program in your login chain.

share|improve this answer
1  
If you remove the dash, you'll need to make sure to set the DB2-related environment variables for that command. –  justarobert Apr 15 '11 at 11:54
add comment

/etc/sudoers does not govern the behavior of su. You want something like

sudo -u db2inst1 "/home/db2inst1/sqllib/bin/db2 list database directory"
share|improve this answer
    
Actually sudo doesnot work with STAF framework, so I need to execute it with su - useranem -c Command only. –  Sanjeev Apr 15 '11 at 10:07
    
su doesn't normally have the restriction of needing to run in a tty; it's used all the time in init scripts, for example. Could this be a limitation of the db2 binary or of staf? What happens when you put the command into a shell script and run it? –  justarobert Apr 15 '11 at 10:17
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.