2016-08-10 4 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가 내장 떠들썩한 파티가 (터미널에서 type cd를 실행하는) 것입니다. 따라서 ssh는 cd을 쉘로 실행하려고 시도하지만 PATH에서 찾을 수 없습니다.

이 같은 SSH 뭔가를 호출해야합니다

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