password is not set 问题解决

在熟悉quagga基本命令的过程中,由于运行了

$ service password-encryption

这条命令是将设定的密码以密文的形式显示。由于好奇心的驱使,运行了

$ no service password-encryption

运行之前,我以为这条命令是使得加密的密码以明文形式显示出来,但是运行后,发现是把密码删除了,密码变为空,去网上查到的说法是这条指令使用的是MD5的加密,加密后,即使用no service password-encryption命令,也不会显示以前加密过的密码,因为这个加密过程是不可逆的。
但是,由于当时并没有意识到是把密码清空了,就正常退出了,结果再想进行连接的时候,即执行完以下指令后

$ telnet localhost 2601
  2601 是services中记录的zebra的端口号

提示以下信息:

Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is'^]'.
Vty password is not set.
Connection closed by foreign host.

查找官方文档,其中确实给出了说明,在进入zebra时,必须设置了密码,否则vty拒绝接受连接。
 

在这里插入图片描述


那遇到这种已经拒绝连接,没有办法再进入configure terminal进行密码修改的情况怎么办呢?
直接修改zebra配置文件,配置文件位于/etc/quagga路径下,这个地方需要root权限,可通过以下命令进入root用户。

$ sudo passwd root
  设置root用户密码
$ su root
  输入密码进入即可

$ vim zebra.conf

可以看到文件内容如下(修改后):

在这里插入图片描述

设置其中的password内容即可。
然后重启一下系统,再执行telnet命令便可以进入quagga了。

emmmm,以后还是要先确定一下命令到底是做什么的再运行才好,否则后果很尴尬…

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
非常感谢您的指出,确实有问题。在Java中,ZipInputStream中没有setPassword方法,需要使用第三方库才能支持密码保护的Zip文件的解压缩。在这里,我们可以使用Apache Commons Compress库来支持密码保护的Zip文件的解压缩。 以下是使用Apache Commons Compress库解压密码保护的Zip文件的Java代码示例: ```java import org.apache.commons.compress.archivers.zip.ZipArchiveEntry; import org.apache.commons.compress.archivers.zip.ZipFile; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; public class UnzipFolder { public static void main(String[] args) { String folderPath = "/path/to/folder"; // 文件夹路径 String password = "password"; // 解压密码 File folder = new File(folderPath); if (folder.exists() && folder.isDirectory()) { File[] files = folder.listFiles(); for (File file : files) { if (file.getName().endsWith(".zip")) { // 如果是zip文件 unzip(file, password); } } } else { System.out.println("Folder does not exist or is not a directory."); } } public static void unzip(File file, String password) { byte[] buffer = new byte[1024]; try { ZipFile zipFile = new ZipFile(file); zipFile.setPassword(password); String destDirPath = file.getParent(); for (ZipArchiveEntry entry : zipFile.getEntries()) { String entryName = entry.getName(); InputStream inputStream = zipFile.getInputStream(entry); File destFile = new File(destDirPath, entryName); if (entry.isDirectory()) { destFile.mkdirs(); } else { FileOutputStream outputStream = new FileOutputStream(destFile); int len; while ((len = inputStream.read(buffer)) > 0) { outputStream.write(buffer, 0, len); } outputStream.close(); } inputStream.close(); } zipFile.close(); System.out.println("Unzip " + file.getName() + " successfully."); } catch (IOException e) { System.out.println("Unzip " + file.getName() + " failed."); e.printStackTrace(); } } } ``` 在代码中,我们使用了Apache Commons Compress库中的ZipFile类来打开Zip文件,并通过调用setPassword()方法指定了密码。在解压Zip文件时,我们遍历Zip文件中的所有条目,并根据需要创建目录或文件,然后将条目的内容写入文件中。 请注意,使用第三方库的时候,需要在项目的构建路径中添加相应的依赖。在这里,我们需要添加以下Maven依赖: ```xml <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-compress</artifactId> <version>1.21</version> </dependency> ``` 希望这次的回答能够帮到您,感谢您的支持和理解。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值