繁体   English   中英

ssh和scp命令的区别

[英]Difference between ssh and scp command

我正在玩 overthewire 的强盗战争游戏。 在 Level 18 中,bashrc 文件的配置方式是,在验证密码后,它会立即注销尝试登录的用户。 例如:

ssh bandit18@bandit.labs.overthewire.org -p 2220

不起作用。 用户将立即注销。 因此,我尝试使用 scp,密码不正确。

scp bandit18@bandit.labs.overthewire.org:2220/home/bandit18/readme .

即使我设法使用我拥有的密码成功登录。 最后下面的命令起作用了,我也不知道这个。

ssh bandit18@bandit.labs.overthewire.org -p 2220 "cat ~/readme"

为什么“cat ∼/readme”可以做到无需登录即可阅读文件或这里有什么程序?

所以我的问题是:1)为什么相同的密码对 ssh 有效但对 scp 无效? 2) 为什么 ssh 不工作,但是 ssh 指定的 cat 命令工作?

谢谢。

PS:如果有人想要这里的密码: kfBf3eYk5BPBRzwjqutbbfE887SVc5Yd

  1. scp 正在工作: scp -P 2220 bandit18@bandit.labs.overthewire.org:/home/bandit18/readme.

  2. .bashrc 包含exit 0因此 bash 在您通过 ssh 登录后立即退出:

     > ssh bandit18@bandit.labs.overthewire.org -p 2220 "tail -n 2.bashrc" This is a OverTheWire game server. More information on http://www.overthewire.org/wargames bandit18@bandit.labs.overthewire.org's password: echo 'Byebye !' exit 0

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM