/var/net/sys/admin/blog

Archives for Quick Tips & Tricks category

Some sample websites that you can use with curl to display your external public IP. As you know, especially if you are connected to a router, it will provide you private IP via the DHCP and it is NAT’ed. So using ‘ifconfig’, ‘ip addr show’, ‘hostname -I’ or via the GUI won’t show the public IP.

curl ifconfig.co  
curl icanhazip.com
curl ifconfig.me
curl ipecho.net/plain ; echo
curl ident.me ; echo
curl checkip.amazonaws.com
curl bot.whatismyipaddress.com ;echo
curl myexternalip.com/raw
curl whatismyip.akamai.com ; echo
curl myip.dnsomatic.com;echo
curl -s ipinfo.io | jq .ip
#need to install jq

Share

After installing GNS3 or Graphical Network Simulator 3 in Ubuntu Linux, you can run it via the command “gns3” but it does not come with a default launcher or shortcut. To have a nice shortcut to place under your launcher bar or dock, here are the steps:

1. Go to /usr/share/applications folder

tux@freelinux:~$ cd /usr/share/applications

2. Create a filename with extension “desktop” , e.g. gns3.desktop . Configure the following desktop entries as per below. The contents are quite self-explanatory. Save and exit

tux@freelinux:/usr/share/applications$ sudo vi gns3.desktop

[Desktop Entry]
Name=GNS3
Comment=GNS3 Network Simulator
Exec=/usr/bin/gns3
Icon=/home/tux/GNS3/gns3-icon.png
Terminal=false
Type=Application
Encoding=UTF-8
Categories=Application;

Share

Spotify is considered the king of digital music streaming service that offers millions of songs.  There are 4 steps to install Spotify client in Debian-based Linux.

Tested in Ubuntu 16.04 LTS. Enjoy!

1.Add Spotify’s repository signing key to verify downloaded packages
sudo apt-key adv –keyserver hkp://keyserver.ubuntu.com:80 –recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886

2. Add Spotify repository
echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list

3. Check and update latest version
sudo apt-get update

4. Install the Spotify client
sudo apt-get install spotify-client

Run “spotify” in the command-line or find from the Applications

Share

Sublime Text is one of the best text or code editor that you can have in Linux as it supports different programming languages and markup languages. There’s a list of features that you can check from the Sublime Text official website, one of my favorites is the python-based plugin API and “Goto Anything” feature.
The only downfall I find is Sublime Text may be downloaded and evaluated for free, however a license must be purchased for continued use.

Installing Sublime Text ver.3 in Ubuntu 16.04 LTS can be done in just 3 steps. As it is not available in Ubuntu Software Center, need to add first the repository before installing it.

Share

Installing a graphical network simulator GNS3 is quite easy for Ubuntu based distribution for 64-bit systems. Tested using Ubuntu 16.04.

sudo add-apt-repository ppa:gns3/ppa
sudo apt-get update
sudo apt-get install gns3-gui

few packages will be installed aside from the gns3-gui , gns3-server

qemu
wireshark
dynamips
cpu-checker

Type “gns3” in command line to launch the application. Enjoy!

tux@freelinux:~$ sudo add-apt-repository ppa:gns3/ppa

Share

For Ubuntu 16.04 LTS or greater, it would be simple as only required two steps to install Fingerprint Scanner. Tested using Lenovo Thinkpad X240

  1. sudo apt install libpam-fprintd
  2. fprintd-enroll

That’s it. You can now login or even use for sudo access using finger print

Alternative: Fingerprint GUI

tux@freelinux:~$ sudo apt install libpam-fprintd
Reading package lists… Done.
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
libpam-fprintd
0 upgraded, 1 newly installed, 0 to remove and 282 not upgraded.
Need to get 0 B/9,336 B of archives.
After this operation, 68.6 kB of additional disk space will be used.
Selecting previously unselected package libpam-fprintd:amd64.
(Reading database … 173955 files and directories currently installed.)
Preparing to unpack …/libpam-fprintd_0.6.0-1_amd64.deb …
Unpacking libpam-fprintd:amd64 (0.6.0-1) …
Setting up libpam-fprintd:amd64 (0.6.0-1) …

Share
  1. Check the current timezone[root@linuxserver ~]# ls -lt /etc/localtime
    lrwxrwxrwx. 1 root root 38 Aug 25 14:15 /etc/localtime -> ../usr/share/zoneinfo/America/New_York

As you can see the current timezone is NY timezone, if we want to change it to for example Singapore, then use the command “timedatectl” to change.

2. List the current timezones available for reference:

[root@dhcpteeserver ~]# timedatectl list-timezones | grep Singapore
Asia/Singapore

3. Change the timezone to Asia/Singapore

[root@linuxserver ~]# timedatectl set-timezone Asia/Singapore
[root@linuxserver ~]# ls -lt /etc/localtime
lrwxrwxrwx 1 root root 36 Sep 1 11:09 /etc/localtime -> ../usr/share/zoneinfo/Asia/Singapore

Enjoy!

Share

SSH Remote Host Identification has changed Error and Fixes

Normally you see this message by remotely accessing via ssh on target systems like Cisco, Juniper or Linux/Unix for possible reasons like:

a.The target systems’ hostname or IP address have changed, and previously belong to a different server which of course has a different public key
b. Server’s public key has changed like SSH reinstallation or update, OS reinstallation or the ssh keygen was being re-run.
c. Can be related to security like unauthorized access or middle in the man attack is happening

Sample:

Share

Important note to remember:
a. capture it in full length, using the -s 0 options
b. save it in a file, better to make the extension as .pcap so wireshark can associate directly

1.Identify which interface you want to listen to

[root@freelinux tmp]# ifconfig 

eth0 Link encap:Ethernet HWaddr 08:00:27:72:24:E6
inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.255.0
inet6 addr: fe80::a00:27ff:fe72:24e6/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:942 errors:0 dropped:0 overruns:0 frame:0
TX packets:612 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:78095 (76.2 KiB) TX bytes:198882 (194.2 KiB)
Interrupt:10 Base address:0xd020

2. Run “tcpdump” command with the following options. For instance, you want to monitor the DNS packets.Run:

Share

There is some instance during the Linux installation that you did not bother to set the correct timezone for any reasons like sometimes you are just lazy to set it, you’re in a rush to finish what your boss want you to complete in that day, or you just don’t give a damn 🙂 Seriously, timezone is a bit important especially if you have scheduled scripts that you intended to run.

Here are some ways to change your timezone depending on your Linux distribution:

for RHEL/CENTOS:

Assuming you have the default or current timezone as UTC and you would like to change it to Singapore timezone

Share
 

About FLT

This site is dedicated to everyone who likes to learn and explore the beautiful world of Linux. If you have comments and suggestions, please feel free to email at freelinuxtutorials@gmail.com. I am happy to serve and share things esp. that is free and enjoyable as Linux.