How to Setup DWM from suckless.org at Kali Linux / Debian

  • Install packages and get dev libraries
sudo apt install dwm suckless-tools
sudo apt install stterm

mkdir /opt
cd /opt

git clone git://git.suckless.org/dwm
cd dwm

sudo apt install libx11-dev libxft-dev libxinerama-dev
  • Make changes in source files:
diff --git a/config.def.h b/config.def.h
index 1c0b587..fc42d00 100644
--- a/config.def.h
+++ b/config.def.h
@@ -44,7 +44,7 @@ static const Layout layouts[] = {
};

/* key definitions */
-#define MODKEY Mod1Mask
+#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
@@ -57,7 +57,7 @@ static const Layout layouts[] = {
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
-static const char *termcmd[] = { "st", NULL };
+static const char *termcmd[] = { "stterm", NULL };

static Key keys[] = {
/* modifier key function argument */
diff --git a/config.mk b/config.mk
index 25e2685..b599bf2 100644
--- a/config.mk
+++ b/config.mk
@@ -7,8 +7,8 @@ VERSION = 6.1
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man

-X11INC = /usr/X11R6/include
-X11LIB = /usr/X11R6/lib
+X11INC = /usr/include/X11
+X11LIB = /usr/lib/X11

# Xinerama, comment if you don't want it
XINERAMALIBS = -lXinerama

 

  • Create file ~/.xinitrc
exec nitrogen --restore &
while true ; do xsetroot -name "`date '+%Y-%m-%d %H:%M.%S'` `uptime |sed 's/.*,//'`"; sleep 1 ; done &
exec /opt/dwm/dwm
  • Run commands:
ln -s ~/.xinitrc ~/.xsession
chmod 755 ~/.xinitrc
  • Create file /usr/share/xsessions/custom-dwm.desktop
[Desktop Entry]
Name=Custom-DWM
Exec=/etc/X11/Xsession
Advertisements

How to Install DWM from suckless.org at Fedora 29

dwm-fedora-2018-11-20-152332_1920x975_scrot

sudo dnf install dwm git dmenu st
mkdir ~/git && cd ~/git
git clone git://git.suckless.org/dwm
cd dwm 

sudo dnf install libX11-devel
sudo dnf install libXft-devel
sudo dnf install libXinerama-devel

sudo dnf install nitrogen
sudo dnf install xorg-x11-xinit-session
  • edit config.mk file
commit 7a013dd1af0bb0fb50ea4496910c98c53c7dd840 (HEAD -> kowalczy-dwm-fedora)
Author: Jacek Kowalczyk <jacekkowalczyk82@gmail.com>
Date:   Tue Nov 20 14:25:20 2018 +0100

    compile at fedora

diff --git a/config.mk b/config.mk
index 25e2685..7d6d132 100644
--- a/config.mk
+++ b/config.mk
@@ -7,8 +7,8 @@ VERSION = 6.1
 PREFIX = /usr/local
 MANPREFIX = ${PREFIX}/share/man

-X11INC = /usr/X11R6/include
-X11LIB = /usr/X11R6/lib
+X11INC = /usr/include/X11
+X11LIB = /usr/lib64/X11

 # Xinerama, comment if you don't want it
 XINERAMALIBS  = -lXinerama

  • edit config.def.h file and do the same change in config.h file
commit 3181727ff56be4fd4d9347a5117d68b90301dc1d (HEAD -> kowalczy-dwm-fedora)
Author: Jacek Kowalczyk <jacekkowalczyk82@gmail.com>
Date:   Tue Nov 20 14:30:09 2018 +0100

    Windows Key as ModKey

diff --git a/config.def.h b/config.def.h
index 1c0b587..0bf6c2a 100644
--- a/config.def.h
+++ b/config.def.h
@@ -44,7 +44,7 @@ static const Layout layouts[] = {
 };

 /* key definitions */
-#define MODKEY Mod1Mask
+#define MODKEY Mod4Mask
 #define TAGKEYS(KEY,TAG) \
        { MODKEY,                       KEY,      view,           {.ui = 1 << TAG} }, \
        { MODKEY|ControlMask,           KEY,      toggleview,     {.ui = 1 << TAG} }, \

  • rebuild by sudo make clean install
  • edit ~/.xinitrc file
exec nitrogen --restore &
while true ; do xsetroot -name "`date '+%Y-%m-%d %H:%M.%S'` `uptime |sed 's/.*,//'`"; sleep 1 ; done &
exec ~/git/dwm/dwm
  • ln -s ~/.xinitrc ~/.xsession
  • chmod 755 ~/.xsession
  • on next login select User Script session
  • sudo nano /usr/share/xsessions/custom-dwm.desktop
[Desktop Entry]
Name=Custom-DWM
Exec=/usr/libexec/xinit-compat
  • on next login select Custom-DWM session

Msys2 POSIX tools on Windows

How to turn your Windows 10 into unix like environment

 

What is Msys2 [ http://www.msys2.org/ ]

MSYS2 is a software distro and building platform for Windows

At its core is an independent rewrite of MSYS, based on modern Cygwin (POSIX compatibility layer) and MinGW-w64 with the aim of better interoperability with native Windows software. It provides a bash shell, Autotools, revision control systems and the like for building native Windows applications using MinGW-w64 toolchains.

It features a package management system to provide easy installation of packages, Pacman. It brings many powerful features such as dependency resolution and simple complete system upgrades, as well as straight-forward package building.

 

How to install it and add basic tools?

  • Get Msys2 from http://www.msys2.org/
  • Install as described at the msys2 home page
  • Rename the file c:\msys64\usr\bin\ssh.exe to c:\msys64\usr\bin\ssh.exe_old
  • Run commands in Msys2 terminal window
pacman -S net-utils msys/screenfetch
pacman -S msys/vim msys/bc nano msys/tmux wget gzip zip unzip msys/p7zip tar msys/tree

Have fun!!!

 

How to resize VirtualBox virtual drive VDI

Let’s say we want to resize the VDI to 60GB

  • Make a backup of the VDI file you want to resize
  • "c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" modifyhd my-favourite-os.vdi --resize 61440
    
    
  • Download gParted ISO and add it as LiveCD to your virtualbox machine
  • Boot gParted from LiveCD ISO
  • Resize partition.
  • Remove gParted iso
  • Boot the virtual machine
  • Check partitions by ‘df -h’

If you are using Logical Volume Manager then extra steps needs to be done:

  • Run LVM tools: (use slightly less size for LVM then for disk drive and take into account swap size)
    lvs 
    lvresize volume-group-name/logical-volume-name --size 56G
    #example:
    lvresize fedora_fedora-xfce/root --size 56G
    #
    resize2fs /dev/mapper/volume-group-name-logical-volume-name 56G
    #example:
    resize2fs /dev/mapper/fedora_fedora--xfce-root 56G

Creating a custom Linux Distro image

This post is about creating a custom Linux distribution ISO. I already created four different distributions: Kali Linux with i3wm, Kali Linux with Openbox, and Arch Linux with i3wm, and Manjaro with Openbox. Both Kali Linux iso contains installer and live options. Arch ISO is just livecd ISO which allows, of course, to install Arch in “Arch way “.

  • Documentation and example configs for My Custom Kali Linux can be found in my repo: https://gitlab.com/jacekkowalczyk82/my-debian
  • Creation of Arch Linux iso is more complicated and I was not happy about this process so I will not publish any manual about it.
  • Creation of Manjaro Linux distribution ISO was quite simple and I will document it later.

Update 2018-09-05:

Kali Linux team published my story about customization of Kali Linux.

https://www.kali.org/tutorials/my-custom-kali-linux-distribution/

Instant one line setup FTP server

One line setup FTP server by The Swiss File Knife

  • I just found it … I needed to run some ftp server and do not waist time for setting all complicated configs for any popular FTP server
  • I wanted to have something similar to python -m SimpleHTTPServer 9191
  • I found The Swiss File Knife which provides ftp server
./sfk-linux.exe ftpserv -user=foo -pw=bar ./FTP_ROOT_DIRECTORY/
note : cannot bind on port 21, using alternative port 2121.
SFK Instant FTP 105. For help, type &quot;sfk ftpserv -help&quot;.
waiting on port 2121, IP 10.10.10.10 or 11.11.11.11.
only read allowed. 60 sec timeout.

  • SFK is available for Windows, Linux, Mac