usrun command

Hi,
I need to run usrun command and direct console output into a text file.
eg:

usrun -h <hostname> nobody

The above example retunns

/bin/usrun[39]: Permission denied

on the screen. I want this string to be directed into a text file.

Please help me to achieve this.
Any help in this regard would be much appreciated.

Cheers,
Mandy

just add

2>/tmp/yourlogfile.err

after "nobody "

Please avoid duplicate posting

Thanks for your help!!!! Its worked as expected.....

One more question.....this is for the host that can not be connected to.

But if connection to a host is successful, in this case it does not return the prompt and looks freeze because prompt is now available on host mentioned in usrun command.

I want to return back to my actual prompt where the command executed from.

Actually I've a list of hostnames (around 1000) and need to check how many of these hostnames allow to connect.

I need to create a report for these hostnames.
I also tried to write a perl script and used 'exit' command in it but could not return to actual prompt.

Please help.

cheers,
mandy

did you try something like

echo "exit" | usrun -h "$anyhost" nobody 2>/tmp/usrunlog.err

?

Thank you very much!!!!
I used above mentioned command and its working properly.

Thanks again!!!!!!!!!!!!!!!

Cheers,
mandy