0
我想在多臺計算機上遠程安裝一個寶石,但我得到不同的行爲,當我運行交互(它的工作原理),或當它在批次(拒絕):爲什麼MacOs ssh爲批處理和交互模式提供不同的權限?
$ ssh [email protected] 'gem install iStats'
Warning: Permanently added '192.168.19.82' (ECDSA) to the list of known hosts.
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.
$ ssh [email protected]
Warning: Permanently added '192.168.19.82' (ECDSA) to the list of known hosts.
Last login: Thu Jan 26 10:50:17 2017 from 192.168.21.168
qa$ gem install iStats
Building native extensions. This could take a while...
Successfully installed iStats-1.4.0
Parsing documentation for iStats-1.4.0
Done installing documentation for iStats after 0 seconds
1 gem installed
qa$ id
uid=502(qa) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),395(com.apple.access_ftp),101(com.apple.access_screensharing-disabled),102(com.apple.access_ssh-disabled)
qa$ logout
Connection to 192.168.19.82 closed.
$ ssh [email protected] 'id'
Warning: Permanently added '192.168.19.82' (ECDSA) to the list of known hosts.
uid=502(qa) gid=20(staff) groups=20(staff),12(everyone),61(localaccounts),79(_appserverusr),80(admin),81(_appserveradm),98(_lpadmin),33(_appstore),100(_lpoperator),204(_developer),395(com.apple.access_ftp),101(com.apple.access_screensharing-disabled),102(com.apple.access_ssh-disabled)
我發現,這個作品:
$ echo ' gem install iStats; exit ' | ssh -t -t [email protected]
Warning: Permanently added '192.168.19.82' (ECDSA) to the list of known hosts.
Last login: Thu Jan 26 11:40:31 2017 from 192.168.21.168
qa$ gem install iStats
Building native extensions. This could take a while...
Successfully installed iStats-1.4.0
Parsing documentation for iStats-1.4.0
Done installing documentation for iStats after 0 seconds
1 gem installed
logout
...但我基於tty的改變在權限驚訝。
這個蘋果是不是很奇怪,或者這是正常的,我錯過了它?