2016-08-10 22 views
1

チームリモートsshコマンドの問題

リモートマシンでコマンドを実行する際にいくつかの問題があります。 sshが私が渡すコマンドがホストであると思っている理由を理解できません。

ssh -tt -i /root/.ssh/teamuser.pem [email protected] 'cd ~/bin && ./ssh-out.sh' 

|-----------------------------------------------------------------| 
| This system is for the use of authorized users only.   | 
| Individuals using this computer system without authority, or in | 
| excess of their authority, are subject to having all of their | 
| activities on this system monitored and recorded by system  | 
| personnel.              | 
|                 | 
| In the course of monitoring individuals improperly using this | 
| system, or in the course of system maintenance, the activities | 
| of authorized users may also be monitored.      | 
|                 | 
| Anyone using this system expressly consents to such monitoring | 
| and is advised that if such monitoring reveals possible   | 
| evidence of criminal activity, system personnel may provide the | 
| evidence of such monitoring to law enforcement officials.  | 
|-----------------------------------------------------------------| 

ssh: Could not resolve hostname cd: No address associated with hostname 
Connection to myserver closed. 

コマンドを渡さないと、正常に動作します。それは単に私を記録しています。

答えて

0

Man sshは言う:コマンドが指定されている場合は

、それは代わりに ログインシェルのリモートホスト上で実行されます。

事がcdは内蔵のbashは(あなたの端末でtype cdを実行する)であるということです。だから、sshはcdをシェルとして実行しようとしますが、PATHでそれを見つけることはできません。

ssh [email protected] -t 'bash -l -c "cd ~/bin && ./ssh-out.sh"' 

あなたはこのようにssh何かを呼び出す必要があります

関連する問題