通过PuTTY自动在MikroTik路由器上执行命令

时间:2015-07-29 08:26:04

标签: cmd putty mikrotik

我正在尝试通过终端远程将用户添加到MikroTik路由器。首先我打开PuTTY,然后输入正确的命令添加用户,但我总是犯同样的错误:

  

“无法打开与1.1.1.1.1的连接”(这是我的真实地址)   “网络错误:无法分配请求的地址”

我该怎么办?

我插入cmd的命令是:

putty -ssh username@1.1.1.1.1 22 -pw mypass '/ip hotspot user add limit-uptime=1h server=all name=user1 password=user1'

提前谢谢

1 个答案:

答案 0 :(得分:0)

错误消息确实令人困惑。 PuTTY显然被错误的命令行语法搞糊涂了:

  1. 您必须使用<?php // Make sure an ID was passed if(isset($_GET['id'])) { // Get the ID $id = intval($_GET['id']); // Make sure the ID is in fact a valid ID if($id <= 0) { die('The ID is invalid!'); } else { // Connect to the database $dbLink = new mysqli('localhost', 'root', '', 'myTable'); if(mysqli_connect_errno()) { die("MySQL connection failed: ". mysqli_connect_error()); } // Fetch the file information $query = " SELECT `mime`, `name`, `size`, `data` FROM `file` WHERE `id` = {$id}"; $result = $dbLink->query($query); if($result) { // Make sure the result is valid if($result->num_rows == 1) { // Get the row $row = mysqli_fetch_assoc($result); // Print headers header("Content-Type: ". $row['mime']); header("Content-Length: ". $row['size']); header("Content-Disposition: attachment; filename=". $row['name']); // Print data echo $row['data']; } else { echo 'Error! No image exists with that ID.'; } // Free the mysqli resources @mysqli_free_result($result); } else { echo "Error! Query failed: <pre>{$dbLink->error}</pre>"; } @mysqli_close($dbLink); } } else { echo 'Error! No ID was passed.'; } ?> 开关指定端口号。虽然您根本不需要指定端口号,但如果它是标准的22。
  2. 您无法在PuTTY的命令行中指定命令。你需要使用PLink。
  3. 不要引用命令,除非引号实际上是命令的一部分。
  4. IP地址有4个数字组件,而不是5个。但我认为这只是一个错字,当你混淆了你的真实IP地址时。
  5. -P

    参考文献:

相关问题