Q:

How to eliminate the dialog box arisen when run "setsid scp"?

Due to some reason, I have to use "setsid" to run all of my commands. 
But, when running "setsid scp ~/aaa user1@10.170.3.17:/tmp/", a dialog box requesting for password arose.
Normally, the prompt arises in command line.
Does it caused by some configuration in ssh?
I want to eliminate the box. How to achieve it?

A:

One of the effects of the setsid command is that process that is started via setsid(1) is detached from it's controlling terminal. Without controlling terminal, scp cannot ask for the password on the terminal from which it was started simply because it does not "see" any. However, what it does "see" is the environment variable telling it that there is an X11 window session where it can show a graphical utility to ask you for the password or passphrase needed to unlock the private SSH key which will be used to authenticate to the remote system.
Even if you would unset the environment variable that it "sees" and uses it to route the x11-ssh-askpass dialogue to your screen (DISPLAY), that would probably not produce the desired effect for you, since required key would be missing and scp operation would fail.
One of solutions that I would recommend here would be setting up a "passwordless" login (if applicable in given security circumstances), using ssh-keygen(1) to produce "identity keys" that will not be password-protected.
You might explore other possibilities, for example providing passphrase in a file or on command line option, whatever works better for you. Please have a look in the ENVIRONMENT section of ssh(1) manpage.

