Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/shell/5.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
Bash smbclient中的Shell脚本?_Bash_Shell_Smb - Fatal编程技术网

Bash smbclient中的Shell脚本?

Bash smbclient中的Shell脚本?,bash,shell,smb,Bash,Shell,Smb,我在smbclient内执行shell(bash)脚本时遇到问题 看起来是这样的: rafal@amilo:~/Desktop$ rafal@amilo:~/Desktop$ #script.sh is here rafal@amilo:~/Desktop$ rafal@amilo: smbclient //host/user -U user%password smb: \> smb: \> #do some automatic things here: execute scri

我在smbclient内执行shell(bash)脚本时遇到问题

看起来是这样的:

rafal@amilo:~/Desktop$ 
rafal@amilo:~/Desktop$ #script.sh is here
rafal@amilo:~/Desktop$ 
rafal@amilo: smbclient //host/user -U user%password
smb: \>
smb: \> #do some automatic things here: execute script.sh from rafal@amilo
smb: \>
smb: \>exit
rafal@amilo:~/Desktop$ #now i have new files in Desktop

我如何才能让它工作?

smbclient允许您进入samba目录。如果目标服务器是Windows,您将无法(轻松地)运行“bash脚本”,但无法使用专用工具运行“批处理脚本”。 例如,您可以使用WinExec()或SMBMap()


这些工具的行为与Sysinternals中的PsExec相同。选项允许您指定应在smb外壳内“执行”的命令。您是对的,它可以工作:smbclient//host/user-U user%password-c command1;命令2;命令3;。。。