scp和ssh的使用

the usage of scp and ssh

我是 Linux 的新手,正在尝试设置无密码的 ssh。我正在按照 link 中的说明进行操作:http://wiki.hands.com/howto/passphraseless-ssh/.

在上面的link中表示:"One often sees people using passphrase-less ssh keys for things like cron jobs that do things like this:"

scp /etc/bind/named.conf* otherdns:/etc/bind/
ssh otherdns /usr/sbin/rndc reload

这很危险,因为这里使用的密钥在不需要时被提供了 root 写访问权限。

我对上面的命令有些困惑。 我了解scp的用法。但是对于ssh来说,"ssh otherdns /usr/sbin/rndc reload"是什么意思?

"the key that's being used here is being offered root write access." 有谁也能帮忙解释一下这句话更详细吗?根据我的理解,密钥是一台服务器生成并复制的 public 密钥 给其他人。 "being offered root write access" 是什么意思?

意思是运行远程服务器上的命令。

语法是

ssh <remote> <cmd>

所以在你的情况下

ssh otherdns /usr/sbin/rndc reload

基本上是4个部分:

  • ssh: 运行 ssh 可执行文件
  • otherdns:是远程服务器;它缺少 user 信息,因此默认用户(与当前登录的用户相同;或在 ~/.ssh/config 中为此远程计算机配置的用户)
  • /usr/sbin/rndc 是远程服务器上的一个程序 运行
  • reload 是远程机器上 运行 程序的参数

所以简单来说,你的命令意味着:

run the program /usr/sbin/rndc with the argument reload on the remote machine otherdns