我需要登录到远程计算机后运行一组命令 -脚本用于登录用户和执行另一个脚本
sudo su - weblogic
Enter password
sh /pathtofile.sh
下面的方法没有做任何事情。它以weblogic的身份将我登录到服务器,但不做任何事情。当我按下Ctrl + C,则它执行SH/pathtofile.sh
ssh -t [email protected] 'sudo su - weblogic; sh /pathtofile.sh'
我已经到处找我可以,但我却无法找到正确的解决了这一点。请帮忙!
这可能有助于http://superuser.com/questions/243499/automating-the-sudo-su-user-command –
你可以使用[期待](http://stackoverflow.com/questions/ 19226563 /使用,预计脚本到DO-AN-SSH-从-A-远程机)完成这个任务。 – user1934428