Results 1 to 6 of 6

Thread: Top Configuration Changes after installing Kali Linux on Raspberry Pi 2

  1. #1

    Top Configuration Changes after installing Kali Linux on Raspberry Pi 2

    First off I'd like to say great job on the Raspberry Pi edition of Kali Linux.

    Before starting this tutorial I'm assuming that you have already installed a fresh image of Kali Linux on your Raspberry Pi

    This tutorial will focus on portability so once you plug your Raspberry Pi 2 in to power it on you don't have to connect a monitor, mouse or even an ethernet cable if on wifi just power will be sufficent. The only suggestion in the future would be to remove vino as it's terribly buggy for these kind of remote applications but we will fix this.

    Kali linux by default uses
    Code:
    /usr/lib/vino/vino-server --sm-disable
    in startup applications however vino-server isn't the greatest it's very buggy for doing remote access without a screen atached so I recommend tightvncserver instead of fixing the broken vino-server as it's much easier than dropping into source code.

    Lets Start!

    Plug in with HDMI, keyboard and mouse to follow along till we are done here

    Login with default password root and toor

    type startx then press enter to get to the GUI but you don't have to

    open a terminal or if you are not in the GUI you should have one already

    Change the root password
    Code:
    passwd
    Now enter a new password of your choice

    With that out of the way lets begin!

    --GET NETWORK INTERFACES WORKING--
    Set Network Manager management to true (why this is not set to true by default, who knows...)
    Code:
    nano /etc/NetworkManager/NetworkManager.conf
    set managed=false to managed=true then save

    Code:
    service network-manager restart
    Now your ethernet port should not say this "not managed"... yet again they really need to change this


    --GET VNC SERVER ON BOOT WORKING--
    Install tightvncserver (this is more than likely already installed)
    Code:
    sudo apt-get install tightvncserver
    --VNC SERVER ON BOOT--
    Create new file called vncboot in init.d directory to create the vnc server as a service
    Code:
    nano /etc/init.d/vncboot
    Put in the following
    Code:
    ### BEGIN INIT INFO
    # Provides: vncboot
    # Required-Start: $remote_fs $syslog
    # Required-Stop: $remote_fs $syslog
    # Default-Start: 2 3 4 5
    # Default-Stop: 0 1 6
    # Short-Description: Start VNC Server at boot time
    # Description: Start VNC Server at boot time.
    ### END INIT INFO
    
    #! /bin/sh
    # /etc/init.d/vncboot
    
    USER=root
    HOME=/root
    
    export USER HOME
    
    case "$1" in
     start)
      echo "Starting VNC Server"
      #Insert your favoured settings for a VNC session
      su - root -c "/usr/bin/vncserver :0 -geometry 1280x800 -depth 16 -pixelformat rgb565"
      ;;
    
     stop)
      echo "Stopping VNC Server"
      /usr/bin/vncserver -kill :0
      ;;
    
     *)
      echo "Usage: /etc/init.d/vncboot {start|stop}"
      exit 1
      ;;
    esac
    
    exit 0
    Make it executable with 755 permissions and update to be default service on boot
    Code:
    chmod 755 /etc/init.d/vncboot
    update-rc.d vncboot defaults
    Now start the service (this is needed to set the default password for your vnc server)
    Code:
    service vncboot start
    It will prompt you the first time to enter a password for your vnc server enter your password once the confirm it and for view only use 'n' and enter
    The vncserver now should be started and will start on boot.

    --AUTO BOOT AND LOGIN STARTX--

    The problem you will have now is that when you boot your Raspberry Pi you will not have access to vnc on boot if it doesn't login automatically for you to do this complete the following:
    Code:
    nano /etc/inittab
    Add # in front of this line
    Code:
    1:2345:respawn:/sbin/getty 115200 tty1
    Add this below the line we commented out:
    Code:
    1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1
    Now we need to edit ~/.profile
    Code:
    nano ~/.profile
    Add the following just before the last line of code
    Code:
    if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
    /usr/bin/startxfce4
    fi
    --EXTRA GOODIES--
    If not seeing colors in terminal bugs you as much as it does me, uncomment these lines in ~/.bashrc:
    Code:
    export LS_OPTIONS='--color=auto'
    eval "`dircolors`"
    alias ls='ls $LS_OPTIONS'
    alias ll='ls $LS_OPTIONS -l'
    alias l='ls $LS_OPTIONS -lA'
    If you want to set a cool ssh login message for your Raspberry Pi like this cool one:
    Code:
    █ ▄▄   ▄ ▄      ▄   █ ▄▄  ▄█ 
    █   █ █   █      █  █   █ ██ 
    █▀▀▀ █ ▄   █ ██   █ █▀▀▀  ██ 
    █    █  █  █ █ █  █ █     ▐█ 
     █    █ █ █  █  █ █  █     ▐ 
      ▀    ▀ ▀   █   ██   ▀
    Just edit this file and drop your message in there
    Code:
    nano /etc/motd
    If you want to disable the last login portion of the banner on ssh login edit this file
    Code:
    nano /etc/ssh/sshd_config
    Then change PrintLastLog yes to PrintLastLog no and save

    If you want to change the name of your Raspberry Pi hack machine edit this file
    Code:
    nano /etc/hostname
    Keep in mind metasploit from the repositories is having issues at this time but I will update this tutorial with that information once I figure it out.

    I also at somepoint be adding how to turn one of your wifi adapters on this to a hotspot so you can connect to the pi over wireless and use it for wireless pentesting too

    Happy pen-testing!

    -lillypad
    Last edited by lillypad; 2015-05-12 at 13:22.

  2. #2
    Join Date
    2015-Jul
    Posts
    15
    Thanks lilypad,

    Awesome Tutorial

    Can't wait to get VNC server on the the Pi using your guide.

    Appreciated.
    Last edited by drewsky; 2015-08-17 at 09:56.

  3. #3
    Join Date
    2014-Feb
    Posts
    309
    The setting is because /etc/network/interfaces controls eth0 - if you want networkmanager to use it/control it, simply remove it from /etc/network/interfaces instead of changing that setting.

    See https://wiki.debian.org/NetworkManager for more details.

  4. #4
    Join Date
    2016-Dec
    Posts
    3
    I have followed the steps and after I tried to run service vncboot start, I get the following error message:
    Job for vncboot.service failed because the control process exited with error code. See "systemctl status vncboot.service" and "journalctl -xe" for details.

    After I run: systemctl status vncboot.service i get the following message:
    Code:
    vncboot.service - LSB: Start VNC Server at boot time
       Loaded: loaded (/etc/init.d/vncboot; bad; vendor preset: disabled)
       Active: failed (Result: exit-code) since kam 2016-12-01 14:28:45 UTC; 5min ago
         Docs: man:systemd-sysv-generator(8)
      Process: 1259 ExecStart=/etc/init.d/vncboot start (code=exited, status=203/EXEC)
    
    kax 01 14:28:45 kali systemd[1]: Starting LSB: Start VNC Server at boot time...
    kax 01 14:28:45 kali systemd[1]: vncboot.service: Control process exited, code=exited status=203
    kax 01 14:28:45 kali systemd[1]: Failed to start LSB: Start VNC Server at boot time.
    kax 01 14:28:45 kali systemd[1]: vncboot.service: Unit entered failed state.
    kax 01 14:28:45 kali systemd[1]: vncboot.service: Failed with result 'exit-code'.
    Command: journalctl -xe displays the following output:
    Code:
    kax 01 14:27:07 kali dbus-daemon[372]: Activating service name='org.gnome.GConf'
    kax 01 14:27:07 kali dbus-daemon[372]: Successfully activated service 'org.gnome.GConf'
    kax 01 14:27:23 kali dhclient[634]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
    kax 01 14:27:32 kali dhclient[634]: No DHCPOFFERS received.
    kax 01 14:27:32 kali dhclient[634]: No working leases in persistent database - sleeping.
    kax 01 14:28:42 kali polkitd(authority=local)[181]: Registered Authentication Agent for unix-process:1207:224787 (system bus name :1.43 [/usr/bin/pkttyagent --notify-fd 4 --fallback], object
    kax 01 14:28:42 kali systemd[1]: Stopped LSB: Start VNC Server at boot time.
    -- Subject: Unit vncboot.service has finished shutting down
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- Unit vncboot.service has finished shutting down.
    kax 01 14:28:42 kali polkitd(authority=local)[181]: Unregistered Authentication Agent for unix-process:1207:224787 (system bus name :1.43, object path /org/freedesktop/PolicyKit1/Authenticat
    kax 01 14:28:45 kali polkitd(authority=local)[181]: Registered Authentication Agent for unix-process:1233:225070 (system bus name :1.44 [/usr/bin/pkttyagent --notify-fd 4 --fallback], object
    kax 01 14:28:45 kali systemd[1]: Starting LSB: Start VNC Server at boot time...
    -- Subject: Unit vncboot.service has begun start-up
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- Unit vncboot.service has begun starting up.
    kax 01 14:28:45 kali systemd[1259]: vncboot.service: Failed at step EXEC spawning /etc/init.d/vncboot: Exec format error
    -- Subject: Process /etc/init.d/vncboot could not be executed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- The process /etc/init.d/vncboot could not be executed and failed.
    -- 
    -- The error number returned by this process is 8.
    kax 01 14:28:45 kali systemd[1]: vncboot.service: Control process exited, code=exited status=203
    kax 01 14:28:45 kali systemd[1]: Failed to start LSB: Start VNC Server at boot time.
    -- Subject: Unit vncboot.service has failed
    -- Defined-By: systemd
    -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    -- 
    -- Unit vncboot.service has failed.
    -- 
    -- The result is failed.
    kax 01 14:28:45 kali systemd[1]: vncboot.service: Unit entered failed state.
    kax 01 14:28:45 kali systemd[1]: vncboot.service: Failed with result 'exit-code'.
    kax 01 14:28:45 kali polkitd(authority=local)[181]: Unregistered Authentication Agent for unix-process:1233:225070 (system bus name :1.44, object path /org/freedesktop/PolicyKit1/Authenticat
    kax 01 14:33:36 kali dhclient[634]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
    kax 01 14:33:41 kali dhclient[634]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6
    kax 01 14:33:47 kali dhclient[634]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
    kax 01 14:33:54 kali dhclient[634]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 15
    kax 01 14:34:09 kali dhclient[634]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 19
    kax 01 14:34:28 kali dhclient[634]: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 9
    kax 01 14:34:37 kali dhclient[634]: No DHCPOFFERS received.
    kax 01 14:34:37 kali dhclient[634]: No working leases in persistent database - sleeping.
    Help pls.[/I]

    I didn't paid attention, but the script has to begin with #!/bin/sh
    Last edited by markojic; 2016-12-02 at 19:03. Reason: shebang misplaced

  5. #5
    Join Date
    2014-Jan
    Posts
    8
    tried this , same error , tried swapping to other DE and same error , did nothing ,

  6. #6
    Join Date
    2015-Nov
    Location
    Australia
    Posts
    445
    Hi spydergto,

    This thread seems a bit outdated.
    You can either use the standard kali 2017.1 image, install tigervnc-standalone-server, and get this vncserver service file.
    Or you could just use Sticky-Fingers Kali-Pi, which comes with a working vnc server as service out of the box (just enable it via "systemctl enable vncserver@1").

    Hope this helps,
    Re4son

Similar Threads

  1. wlan0 configuration for raspberry pi 3 Model B
    By sjens76 in forum ARM Archive
    Replies: 0
    Last Post: 2021-01-30, 13:23
  2. Installing Kali Linux on a Raspberry Pi 3 Model B +
    By KaliTut in forum Installing Archive
    Replies: 0
    Last Post: 2019-07-28, 14:26

Posting Permissions

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