Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Unix 使用非交互式SSH登录删除文件_Unix_Ssh_Sshpass - Fatal编程技术网

Unix 使用非交互式SSH登录删除文件

Unix 使用非交互式SSH登录删除文件,unix,ssh,sshpass,Unix,Ssh,Sshpass,我正在尝试使用sshpass从服务器远程删除文件 使用常规的ssh很好: ssh username@ip rm -f fullpath/file.txt username@ip's password: **** 但是当我尝试使用sshpass时: sshpass -p 'password' username@ip rm -f fullpath/file.txt server answer: sshpass: Failed to run command: No such file or dir

我正在尝试使用
sshpass
从服务器远程删除文件

使用常规的
ssh
很好:

ssh username@ip rm -f fullpath/file.txt
username@ip's password: ****
但是当我尝试使用
sshpass
时:

sshpass -p 'password' username@ip rm -f fullpath/file.txt

server answer: sshpass: Failed to run command: No such file or directory
我错过了什么???

找到了

sshpass-p“password”sshusername@iprm-f fullpath/file.txt

为什么不使用公钥?