Results 1 to 6 of 6

Thread: HOW TO: Start Kali with a new unique hostname for each boot

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    2013-Mar
    Posts
    27

    HOW TO: Start Kali with a new unique hostname for each boot

    Given the popularity of this distro, seeing a computer named "kali" on a netowrk may raise a red flag. So, here is a way to avoid appearing as such:

    To get situated, open a terminal and cd to your root directory:
    Code:
    cd ~
    STEP 1: Create a script which will automate the procedure

    In this terminal create a file.
    Code:
    touch newhostname
    leafpad newhostname
    Now, add the following lines to your newly created file:
    Code:
    #!/bin/bash
    
    cp -n /etc/hosts{,.old}
    
    newhn=$(cat /dev/urandom | tr -dc 'A-Za-z' | head -c8)
    echo $newhn > /etc/hostname
    
    echo "127.0.0.1    localhost" > /etc/hosts
    echo "127.0.0.1    $newhn" >> /etc/hosts
    cat /etc/hosts.old >> /etc/hosts
    service hostname.sh stop
    sleep 1
    service hostname.sh start
    xhost +$newhn
    exit
    Save it and exit leafpad.

    STEP 3: Make it run at boot
    Store it:
    Code:
    mv newhostname /usr/bin/newhostname
    Make it executable
    Code:
    chmod +x /usr/bin/newhostname

    Make it run at startup:

    --Click on "Applications" --> "System Tools" --> "Preferences" --> "Startup Applications"
    --Click "Add"
    --Fill in:
    ----Name: New Host Name
    ----Command: /usr/bin/newhostname
    ----Comment: Start Kali with a different hostname each boot




    -Click Save
    -Clost Windows

    All done!
    Last edited by testingresults; 2013-07-02 at 21:29. Reason: Temporary fix
    Clever girl!

Similar Threads

  1. Replies: 4
    Last Post: 2017-10-20, 08:52
  2. Unattended PXE Install - Prompt for Hostname?
    By mattw in forum Installing Archive
    Replies: 0
    Last Post: 2013-09-10, 16:21

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •