Category Archives: HowTo

Find and replace in Nano

Q: How to find and replace a string in Nano?

A: The answer is straightforward, while you are in Nano,

  1. Press Ctrl+\. Notice that a box appears in the bottom of the window
  2. Then type the string you are trying to find and press Enter
  3. Then type the string you want to replace and press Enter
  4. At this point Nano jumps to the first instance of what you are looking for and shows you a set of shortcuts to go and find one by one, by pressing y for accepting and n for skipping, or replace all by pressing a

Continue reading Find and replace in Nano

Run Java applications on Linux

There are still some companies out there that are trying to have a GUI (Graphical User Interface) for their web services specially in scientific society. Most of these application are written in Java and requires user to have a Java enabled machine to run on. All these companies support OSX and Windows but they don’t want to provide support for Linux (for some reason that is not clear for me!). So in this brief tutorial I’m going to answer the question in an easy way:

The question is, how should we run .jlnp file on Linux?
Continue reading Run Java applications on Linux

Remote logout user through SSH

I had an issue with my Ubuntu recently that the computer was not stopping screesaver and didn’t show me the login page after a screenlock. Most people usually try to forcefully shutdown by pressing and holding the power button for about 10 seconds. This is not a good choice specially when you have some services on that machine or having some other users logged in through SSH to that computer.

In this article I will briefly explain how to logout a specific user remotely through SSH without touching or terminating any service or any other user.

Continue reading Remote logout user through SSH

Save file/folder structure including permissions

It has always been a great concern to keep track of folder permissions since most of the lame errors in Linux are due to a permission denial by the system, and sysadmins should change some permissions from time to time to fix things. At this point having a good record of what has been changed is vital since in terminal there is no undo or Ctrl+z and you should keep track of what you are doing to reverse the change and correct the mistakes.

In this post I briefly want to present some lines of code that can help you keep track.

Continue reading Save file/folder structure including permissions

Install and enable SSH in Ubuntu 14.04

I was setting up a service on a local computer with Ubuntu 14.04 Trusty Tahr OS which I realized there is no SSH server daemon what so ever on Ubuntu, so I thought installation and enabling SSH in Ubuntu 14.04 can be a issue for some beginners, so here is the solution:

First you should install the OpenSSH server:

sudo apt-get install openssh-server

Continue reading Install and enable SSH in Ubuntu 14.04

SSH “Host key verification failed” error

There is an annoying error which you get when you want to connect to the same IP via SSH but the server authentication key has been changed and you computer does not accept the risk to connect with a key other than the one you have used before.

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx.
Please contact your system administrator.
Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
Offending key in /home/user/.ssh/known_hosts:1
RSA host key for ras.mydomain.com has changed and you have requested strict checking.
Host key verification failed.

This can happen when you install a new OS on the server (or what ever you are trying to connect with via SSH) or if you have completely change the device on the other end (which is also the same case as changing the OS). This error is basically for your own security and safety but it annoys anyway 😀

In this article i’m going to explain few ways to resolve the issue:

Continue reading SSH “Host key verification failed” error

Add user or group to sudoers file

I had this issue for my Ubuntu and Pidora, so in this article you can have both solutions:

In Ubuntu

The problem I had was to add a user on an Ubuntu 14.04 at my work, so that someone else from the company can help me do some basic maintenance of the system (it was requested by my employee!), so this is how I did it after creating a user (new_user):

 gpasswd -a new_user sudo

This command will add the user new_user to the group sudo.

In Pidora

I was working with Pidora (which is a Fedora remix for Raspberry Pi) and I was about to run a command using sudo that I faced the following error:

[NixSOS@pidora ~]$ sudo iptables -L -n
[sudo] password for NixSOS:
NixSOS is not in the sudoers file. This incident will be reported.

and I was confused for a while and then I searched for a way to add my user in the “sudoers file” and I’m going to explain how to add a user or a group to sudoers file. This should work all major linux distributions.

Continue reading Add user or group to sudoers file

Map a network drive in Mac OSX

There are several places where you need to map a network drive to your computer, for example when you are in a company network and you want to have the shared network drive of your company domain on your computer. The term “mapping” is a technical term for mounting or loading a network drive to a computer.

For this purpose there are more than one way to do it and map the network drive to your Mac OSX and in this article I’m explaining two of those ways which are easier, faster and safer, one from Finder window and the other one from Terminal.

Continue reading Map a network drive in Mac OSX