다음 명령을 사용하여 Ubuntu 서버에서 원격 스크립트/명령을 직접 시작합니다.
ssh me@server 'nano my_file.txt'
그러나 이렇게 하면 오류가 발생합니다.
Error opening terminal: unknown.
또 다른 예에서는 위의 명령이 포함된 원격 스크립트를 호출하면 nano
동일한 오류가 발생합니다.
ssh me@server 'open_nano.sh'
그렇게하면 예상대로 ssh me@server 'echo something'
얻습니다 .something
뭐가 잘못 되었 니?
답변1
깃발 을 사용해야 할 것입니다 -t
.
예:
ssh -t me@server 'nano my_file.txt'
ssh -t me@server 'open_nano.sh'
설명 man ssh
:
-t Force pseudo-tty allocation. This can be used to execute arbi‐ trary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, even if ssh has no local tty.