问题描述
用C语言 在子线程setsid()后执行execvp(arglist[0], arglist);。如果没有安装ssh-askpass则提示
ssh_askpass: exec(/usr/libexec/openssh/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/libexec/openssh/ssh-askpass): No such file or directory
Permission denied, please try again.
ssh_askpass: exec(/usr/libexec/openssh/ssh-askpass): No such file or directory
root@192.168.1.1: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
如果安装了则会自动启动ssh-askpass,要求输入密码。
怎样才能实现不启动启动ssh-askpass, 而是直接在命令行中输入ssh密码?而且注释掉setsid();会发现是不会启动ssh-askpass的。
环境
系统版本 Fedora 28
openssh版本 OpenSSH_7.8p1, OpenSSL 1.1.0h-fips 27 Mar 2018
相关代码
int main() {
int pid;
if ((pid = fork()) == 0) {
printf("child");
setsid();
execlp("ssh", "ssh", "192.168.1.1", NULL);
}
}