Net::SSH sudo command hangs after entering password

前端 未结 6 1494
囚心锁ツ
囚心锁ツ 2020-12-09 13:53

I\'ve been trying to write a small library using Thor to help assist me in quick creating new projects and sites. I wrote this small method:

def ssh(cmd)
           


        
6条回答
  •  [愿得一人]
    2020-12-09 14:18

    The first thing you might want to try is using public keys instead of passwords to login. Then also try running the command from the interactive shell.

    For example:

    (This part really depends on the server/client software you have)

    $ ssh-keygen
    $ scp .ssh/id-dsa.pub server:
    $ ssh server
    server$ cat id-dsa.pub >> .ssh/authorizedkeys
    
    $ scp -c "ls"
    

    this should work without any prompts, if the key sharing was successful.

提交回复
热议问题