debian安装kali_如何查找和更改Ubuntu,Debian,Kali Mint主机名?

debian安装kali

debian安装kali

Hostname is used to identify the Linux hosts. We generally prefer to put related host names to the systems like web1, db5 etc. In this tutorial we will look how to find and print hostname and change it with different methods. Following examples can be used for other Linux distributions like CentOS, Fedora, RedHat too.

主机名用于标识Linux主机。 通常,我们通常喜欢将相关的主机名添加到系统中,例如web1,db5等。在本教程中,我们将研究如何查找和打印主机名以及如何使用不同的方法对其进行更改。 以下示例也可用于其他Linux发行版,例如CentOS,Fedora,RedHat。

查找当前主机名 (Find Current Hostname)

There are different ways to find hostname. But the most easy and stable way is printing related host name configuration. Host name configuration is stored in /etc/hostname which is very easy to find. We will print this configuration file like below.

有多种查找主机名的方法。 但是最简单,最稳定的方法是打印相关的主机名配置。 主机名配置存储在/etc/hostname ,这很容易找到。 我们将如下打印此配置文件。

$ cat /etc/hostname
Find Current Hostname
Find Current Hostname
查找当前主机名

使用hostnamectl命令查找当前主机名(Find Current Hostname with hostnamectl Command)

hostnamectl is a new tool in order to manage host name configuration. We can print current hostname just providing hostnamectl  command like below. As we can more information can be found in the output like Operating system, machine UID etc.

hostnamectl是用于管理主机名配置的新工具。 我们只需提供如下的hostnamectl命令即可打印当前主机hostnamectl 。 我们可以在输出中找到更多信息,例如操作系统,计算机UID等。

$ hostnamectl
Find Current Hostname with hostnamectl
Find Current Hostname with hostnamectl
使用hostnamectl查找当前主机名

临时更改主机名(Change Hostname Temporary)

There is command named hostname which is used to change hostname temporarily. We can provide the name we want to set. But we should have root privileges for host name change.

有一个名为hostname命令,用于临时更改主机名。 我们可以提供我们想要设置的名称。 但是我们应该具有更改主机名的root特权。

$ sudo hostname poftut2
Change Hostname Temporary
Change Hostname Temporary
临时更改主机名

永久更改主机名(Change Host name Permanently)

We can change hostname permanatly too. Previous example will change hostname for current power up. After a reboot the host name will be reverted back. We will edit the hostname configuration file /etc/hostname and put whatever we want.

我们也可以永久更改主机名。 前面的示例将更改当前启动的主机名。 重新启动后,主机名将恢复原状。 我们将编辑主机名配置文件/etc/hostname并放入我们想要的任何内容。

$ sudo echo "poftut3" > /etc/hostname

使用hostnamectl更改主机名 (Change Host name with hostnamectl)

hostnamectl command provides different options to list and set host name and related information. We will use set-hostname  option in order to change host name. We will set host name poftut4 like below.

hostnamectl命令提供了不同的选项来列出和设置主机名以及相关信息。 我们将使用set-hostname选项来更改主机名。 我们将像下面这样设置主机名poftut4

$ sudo hostnamectl set-hostname poftut4
LEARN MORE  How To Exclude Hosts From Nmap Scan?
了解更多如何从Nmap扫描中排除主机?

翻译自: https://www.poftut.com/find-and-change-ubuntu-debian-kali-mint-hostname/

debian安装kali

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值