2016-11-30 98 views
1

SSH遠程網關上如何逃脫的單引號時使用sshpass

sshpass -p gatewaypwd -t [email protected] sshpass -p targetpwd ssh [email protected] 這是原點命令,我把它放在我的別名。它運行良好。 但現在的目標主機的密碼包含單引號 如

sshpass -p gatewaypwd -t [email protected] sshpass -p target'pwd ssh [email protected] 命令不能很好地運行。 我確實試圖通過\'\\\'和其他方法逃脫它,但都沒有成功。 如何逃避報價。

+1

Stack Overflow是編程和開發問題的網站。這個問題似乎與題目無關,因爲它不涉及編程或開發。請參閱幫助中心的[我可以詢問哪些主題](http://stackoverflow.com/help/on-topic)。也許[超級用戶](http://superuser.com/)或[Unix&Linux堆棧交換](http://unix.stackexchange.com/)會是一個更好的地方。另請參閱[我在哪裏發佈有關Dev Ops的問題?](http://meta.stackexchange.com/q/134306) – jww

回答

0
  1. Store中的文本文件密碼
  2. 使用sshpass -f <filename> ssh [email protected]_ADDR

這將需要密碼的文件。我試過這個空白空間,它工作正常。