第 20 章
最佳远程控制方案: SSH
SSH_CONNECTION=192.168.1.12 47143 192.1681.1.10 22 _=/usr/bin/env
20.4.3
在服务器上限制所执行的命令
command="/path/to/some/command args..." ssh-rsa ......(key)......
$ nano -w ~/.ssh/authorized _keys command="ls / > files.list" ssh-rsa yHCBA8quGjcd1U9FXv/X19eSQQk4uLdw4eSqSfwV6m G6ri 37Aha8k6dSJmtJ9OSFqnZYK6iXW5Iv1c2hGilHYfKl9zTM H00EMaAAAB3NzaC1yc2EAAAABIwAAAQEA3+ QaDcFzr30fO24pLg2UQOuLNRxYKFcEGd9J36Ubbp5gR2IcgHhIWtgjn1R8iaMWbS0mUiLQO5HqIOtRC3O m+RRQQjDF6Xbk4CUiQ6V09QSAYZn2P6sjtiv4dl5lCXdBMgwwzBiv zETw9RhLsqC44wtzJT/rA9C7Q7lj JpxRCvmcq/vBHQtIIE8EKr6A1+Q3SWH3R+05zlyr5+xd8k085/1r5DNOKYSeBk/Ba2ibiyM+61SFG0aVw == Hiweed's Key
$ ssh 192.168.1.10
$ cat files.list
20.4.4
修改密钥口令
$ ssh-keygen -p Enter file in which the key is (/home/hiweed/.ssh/id_rsa): Enter old passphrase: Key has comment '/home/hiweed/.ssh/id_rsa' Enter new passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved with the new passphrase.
20.4.5
将密钥放入内存
$ ssh-agent $SHELL $ ssh-add Enter passphrase for /home/hiweed/.ssh/id_rsa: Identity added: /home/hiweed/.ssh/id_rsa (/home/hiweed/.ssh/id_rsa)
$ ssh-add -D All identities removed.
$ exit
313