linux

Viber for Linux

Viber now released Debian binary: www.viber.com/products/linux/

You must have 64bit version of Ubuntu, Debian, Mint or ZorinOS to be able to install the Viber to your Ubuntu system.

Taggings:

How to install viber in Ubuntu?

I want to install Viber in Ubuntu, then I can call people from my Ubuntu system.

Prevent brute-force attack on server with ssh-daemon

If your ssh-server is reachable from the web you have to be careful.
There are many automated bots which are searching for open ports on your server and try to connect to your ssh-server with brute-force attacks.
Almost every attempt from bots is made with the username root because it is the admin user on almost every linux-server on the internet.

One attempt is to prevent successful logins from bots is to create a new user and add it to the sudoers file (/etc/sudoers).
This user is then able to get root-privileges.
If you have testet to connect with this new user over ssh and get root-privs you can set the flag "enable-root-login" at the ssh-server config to false.
Now the root user is not able to connect per ssh to the server.

Connect NFC-Reader to RaspberryPi

NFC - Near Field Communication - is a short range (<10cm) contactless communication protocol. Many Smartphone have an NFC-Chip and several tags (stickers, cards, kesy rings, ...) are available. How can I use an NFC reader (e.g. http://www.identivenfc.com/en/nfc-readers/nfc-oem-reader-usb.htm) on a raspberryPi? To read tags or exchange data with smartphones.

Command-line access to REST endpoints

There is a web application that offers and interface via REST-endpoints for remote access and control. I have a Linux box as my main central tool, and I am used to the "command line" way of working. How would I access the web-acpplication using command line?

Enlarging logical volumes

First, the current status of the logical volume to be resized can be monitored with

sudo lvdisplay

or, alternatively,

sudo lvs

which results in something like:

--- Logical volume ---
LV Name /dev/server/data
VG Name server
LV UUID 5t0OX9-sLc9-jPHb-k4zk-2RnE-fTzB-qjQ3qN
LV Write Access read/write
LV Status available
# open 1
LV Size 1,46 TiB
Current LE 384000
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 252:3

or

LV VG Attr LSize Origin Snap% Move Log Copy% Convert
data server -wi-ao 1,46t

respectively.

Afterwards, the logical volume can be resized using

sudo lvextend -L 100G /dev/server/data

or

sudo lvextend -L +100G /dev/server/data

In the first case, the logical volume is set to exactly 100 Gigabyte, whereas in the second command 100 Gigabyte are added to the current size of the logical volume.

Finally it is necessary to also set the filesystem to the new size of the volume group, as this is not done with the commands above. This can be done

for ext2/ext3/ext4 file systems with

sudo resize2fs -p /dev/server/data

for JFS file systems with

sudo mount /mountpoint -o remount,resize

for XFS file systems with

sudo xfs_growfs /mountpoint

All other file systems cannot be resized while the machine is still online!

Resizing of Logical Volume on live Ubuntu Server

One of the logical volumes of an Ubuntu Server machine needs to be resized (enlarged) in order to be able to handle the amount of data to be stored. This should happen without having to shut down the web server which is currently running on this machine.

Taggings:

SSHDroid, AirDroid

As Google decided to remove USB mass storage support from recent android-versions (starting with version 4.0 - "Ice Cream sandwich") the phone can only be connected via PTP or MTP support. AFAIK this works quite well with Windows and Mac but unfortunately not very well with Linux.
There are however other methods to connect the phone. Two of them I used are:

Both can be obtained from the Google App Store.
SSHDroid sets up an SSH-Server on the Android phone. File transfer can be done via every ssh-able client (command line, explorer, nautilus...).
AirDroid is far more advanced. It sets up a Web server on the Android phone and lets you connect via a standard Web browser to the Android phone. Besides transfer of video, audio or picture files it allows access to standard moblie phone functionalities, like SMS writing (or reading) or camera.
For detailed descriptions of how to set up the tools please refer to the links.

Taggings:

Kill running process in a Unix-based console with the example of the Java Web Server Grizzly

1. Step: We need to find the proper running process in the background, for that we will use the command...


ps aux

... which lists all running processes which mostly is too long of a list:


jurgen 39191 0.0 0.8 904472 69368 ?? S 2:19PM 0:11.78 /Applications/Google Chrome
jurgen 39043 0.0 0.2 2524472 13976 ?? Ss 9:51AM 0:02.62 com.apple.security.pboxd
jurgen 38473 0.0 0.0 2467260 432 ?? Ss Tue03PM 0:00.20 com.apple.XType.FontHelper
...

So we filter out only the process that we are looking for, by using the command 'grep' and using the console pipe '|' to concatenate the commands


ps aux | grep java

Result:

jurgen 39543 0.1 1.9 4845420 163316 s008 S+ 5:49PM 0:07.18 /Library/Java/JavaVirtu... exec:java
jurgen 39573 0.0 0.0 2432768 460 s007 S+ 6:08PM 0:00.00 grep java

Now this returns us the proper process but also the 'grep' process itself which we were just running in our pipe, to filter this, we concatenate yet another 'grep -v grep':


ps aux | grep java | grep -v grep

... and we only get the process we need

jurgen 39543 0.1 1.9 4845420 163316 s008 S+ 5:49PM 0:07.18 /Library/Java/JavaVirtu... exec:java

Now that we have identified our process with its process number 39543 (second column in our process), we can terminate it with the 'kill -9'* command, as follows:


kill -9 39543

* If your wondering: The -9 parameter tells the kill-Command to send a SIGKILL signal to our process

In conclusion the following - more generic code - needs to be executed:

ps aux | grep [server_process_name] | grep -v grep
kill -9 [identified_process_id]

Taggings:

Web server process running in the background needs to be closed

When working with web servers (such as Tomcat, Apache, etc.) their processes are usually started in the background and cannot be easily closed by Ctrl+C or the Close-Button in GUIs. This goes for both the development process on a developer's workstation, as well as directly on the server in test or production. In Windows based systems those processes can be easily found in the process manager that can be accessed via the GUI. In Unix based systems (Linux, MacOSX) such a GUI doesn't always exist (especially on the server) or is sometimes hard to find. We need a console based solution to ... <ul> <li>Find the right web server process that is running in the background</li> <li>Terminate it via the console</li> </ul>

Pages

Subscribe to linux