sabato 21 ottobre 2017

CentOS: reinstall GRUB2 from the CentOS 7 installation disk

Boot from the CentOS 7 installation disk.

Select "Troubleshooting".

Select "Rescue a CentOS Linux system".

Select "3) Skip to shell".

Show the disks partitioning:

fdisk -l

Identify the system partition. In this example, it is "/dev/sda1".

Mount the system partition under "/mnt/sysimage":

mount /dev/sda1 /mnt/sysimage

Reinstall the GRUB2 boot loader:

grub2-install --root-directory=/mnt/sysimage /dev/sda

Exit and reboot.

mercoledì 14 giugno 2017

Windows PC + Linux router: find who is doing traffic

Here is how I can find what PC is doing traffic on my ADSL connection.

I have a Linux-based router. I'm using a Windows PC.

I can login in my router by using PuTTY: so I installed putty on my PC and I configured public-key authentication.

I downloaded Wireshark and I installed it on my PC.

Then I downloaded and installed plink from the PuTTY website.

Finally, I created a .bat script with the following commands:

C:\plink\plink.exe -i "C:\Users\Marco\Documents\router.ppk" -ssh admin@ "tcpdump -s 0 -w -" | "C:\Program Files\Wireshark\wireshark" -i -

The command is copied from this article: HOWTO: Use Wireshark over SSH (Linux and Windows).
I just inserted the absolute paths of plink and of wireshark, I added the "-i" parameter for using the public-key authentication, and I removed the port filter, as I'm interested in all the network traffic.

Now I can execute the .bat script, then I can start the capture of the packets in the Wireshark user interface, I can stop it, then I can go to Statistics/Endpoints/IPv4 or Statistics/Conversations/IPv4 for a better understanding of the network usage.

domenica 5 marzo 2017

Customization of the X keybindings with xmodmap

Here is how I customized the X keybindings with the purpose to make Lisp-editing on Emacs more comfortable.

$ xmodmap -pke # read the current configuration
$ cat .xsession
xmodmap ~/.Xmodmap
$ cat ~/.Xmodmap
! set F5, F6, F7, F8, F9 to control, alt, shift, (, )

clear control
clear mod1

keycode  71 = Control_L
keycode  72 = Alt_L Meta_L
keycode  73 = Shift_L
keycode  74 = parenleft
keycode  75 = parenright

add control = Control_L Control_R
add mod1 = Alt_L Meta_L
$ xmodmap ~/.Xmodmap # load the personalized bindings

Many thanks to Xah Lee for his tutorials: Linux Keybinding How-to