24/05/2014

[Windows] Scan hosts for open ports without Telnet with PortQry

When testing a connection, you'll probably want to check if a particular port is reachable on the destination host. Telnet is fine enough for this task:

telnet host port

but unfortunately, Windows comes with the Telnet client disabled by default. Since enabling it requires you to have Administrator privileges, an alternative is to use Microsoft PortQry which is a command line tool with no installation required.

After downloading and extracting it, you can run it as:

portqry -n host -e port

[VmWare] Reduce guest swapping

VmWare allows you to specify how the guest system handles swapping to the host disk. Much like Linux's swappiness value, you can suggest to use more host memory instead of swapping to disk; this is especially useful if you do not have a swap partition.

To edit the setting, open your VM's .vmx file, while the VM is powered off, using text editor and add these lines:

MemTrimRate = "0"
mainMem.useNamedFile = "FALSE"
sched.mem.pshare.enable = "FALSE"
prefvmx.useRecommendedLockedMemSize = "TRUE"

Note: If you are using a Linux host, use the following entry instead of mainMem.useNamedFile which only applies to Windows hosts:

mainmem.backing = "swap"


[Ubuntu] Add swap partition and change swappiness

If for some reason(s) you decided to install Ubuntu without specifying a swap partition, you can still add one (or a swapfile) later on without too much hassle.

[Debian] Run Wireshark as non-root user

Wireshark by default enables only the root user to capture network traffic; the idea is that as a root user you'll capture and store the traffic and as non-root user you'll perform any analysis you need. This unfortunately does not allow you to perform a "live capture" where you can work on the data while it is freshly captured from your network interface.

To enable non-root users to run a live capture too, simply dpkg-reconfigure it:

sudo apt-get install wireshark
sudo dpkg-reconfigure wireshark-common

When prompted to allow non-root user to perform restricted operations, say Yes.

Then logout and login again and you should be set. If not, add your user to the wireshark group:

sudo usermod -a -G wireshark $USER

[Debian] Test APT changes without altering the system

The APT package manager allows you to test the changes a command would perform without altering the system. To do that, simply add --dry-run to the desired command (usually an install or remove one).

Eg:

apt-get install SOMEPACKAGE --dry-run

Will show you what dependencies will be installed alongside the specified package but no actual installation will take place.

[Linux] Add Wine-installed application launcher to panel or menu

If you need to run Windows applications under Linux, then you're probably using WineHQ. To add a Wine-installed application launcher to the desktop panel or menu, just add a new "Custom launcher" with this command:

bash -c "wine PATH/TO//FILE.EXE"

[FileZilla] Connect to SFTP site with PPK key file

To connect to an SFTP site using a PPK key file with FileZilla, you'll just have to follow some simple steps.

First, add the key file to FileZilla under Preferences->Settings->Connection->SFTP

Then, from the Site Manager fill the fields with the values for your SFTP connection. If you don't need to put in a password, choose "Normal" as "Logon type"

10/05/2014

[Debian] Set up wireless networking on a Lenovo T430 laptop

On a Lenovo T430 running Debian Wheezy and MATE desktop environment, the wireless networking was not working good even after installing the non-free drivers and Wicd, so you can install GNOME's good ol' network-manager instead.

[Debian] Install MATE desktop environment

Now that GNOME 2 is dead in favour of the not-so-good GNOME 3, users are still able to experience their solid and favourite desktop experience with MATE.

Installing it is really simple; this guide will describe how to add it to Debian Wheezy (stable release).

[Debian] Install package and its dependencies using dpkg

When installing a package with dpkg:

dpkg -i package.deb

its dependencies will not be automatically installed. To solve this, run:

apt-get -f install

after the dpkg installation

[Linux] Set LightDM default session

To change the default desktop session the user logs in to from LightDM, run as root:

/usr/lib/x86_64-linux-gnu/lightdm/lightdm-set-defaults -s DEFAULT_SESSION

eg:

/usr/lib/x86_64-linux-gnu/lightdm/lightdm-set-defaults -s mate-session

[Xfce] Disable session saving on shutdown or logout

Xfce can save the current session on shutdown or logout so that the next time the user logs in, all the applications he was using are up and running. Unfortunately, this setting sometimes is enabled even when not requested; to change it, edit ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml by setting these properties:

 <property name="AutoSave" type="bool" value="false"/>  
 <property name="SaveOnExit" type="bool" value="false"/>