0

root アカウントを使用して多数のサーバーにいくつかの公開鍵をプッシュしようとしていますが、これらの新しい鍵を「postgres」ユーザーの下に置きたいと考えています。

私はこれをやっています:

$ cat new_dba_keys.pub | ssh -l root 10.224.1.16 "su - postgres |cat >> ~/.ssh/authorized_keys"
-bash: line 2: ssh-rsa: command not found
-bash: line 4: ssh-rsa: command not found

ご覧のとおり、機能しません。

4

1 に答える 1

0

代わりにsu - postgres | cat ...使用su - postgres -c "cat ..."して、postgre のディレクトリにテキストを配置します。

cat new_dba_keys.pub | ssh -l root 10.224.1.16 "su - postgres -c \"cat >> ~/.ssh/authorized_keys\""
于 2013-02-14T09:02:31.817 に答える