Monthly Archives: February 2017

How to Install and Configure FTP Server in Ubuntu |

FTP (File Transfer Protocol) is a relatively old and most used standard network protocol used for uploading/downloading files between two computers over a network. However, FTP by its original insecure, because it transmits data together with user credentials (username and password) without encryption.

Warning: If you planning to use FTP, consider configuring FTP connection with SSL/TLS (will cover in next article). Otherwise, it’s always better to use secure FTP such as SFTP.
Read more at Tecmint

Click Here!

How to Perform Pattern Search in Files using Grep |

In our first article on the grep command, we covered quite a few features the tool offers, including how you can use it to search only for words, search for two words, count lines containing matched word, and more. Aside from these, the tool provides some more easy-to-understand and useful features. 

This article focuses on some advanced features of the grep command like case insensitive search, displaying certain non-matched lines with line containing matched string, print matched strings in grep, and to display the position of a match in grep.

Read more at HowToForge

Click Here!

How to Install Apache Directory Studio and Connect to an OpenLDAP Server |

If you happen to administer one or more OpenLDAP servers, you know that they can be a challenge to work with. Working with LDAP itself can be a bit tricky; to that end, many opt to go the phpLDAPadmin route (which is an amazing tool for individual servers). However, when you’re managing numerous LDAP servers, you don’t want to have to log in and out of various instances of that tool. If that’s the case, what do you do? There’s one particular piece of software that does an outstanding job of managing multiple LDAP servers: Apache Directory Studio.
Apache Directory Studio is part of the Apache Directory project that strives to increase LDAP awareness, comfort and adoption to bring forth what we call the Modern LDAP Renaissance. The project includes:

  • Apache Directory Server — an extensible and embeddable directory server

  • Apache LDAP API — an enhanced LDAP API

  • Apache Mavibot — a Multi Version Concurrency Control (MVCC) BTree

  • Apache Kerby — a Java Kerberos binding

  • Apache Fortress — a standards-based Access Management System

And, of course, the Apache Directory Studio, which is a tool intended to be used with any LDAP platform.
I am going to walk you through the process of installing Apache Directory Studio as well as how to connect it to a working LDAP instance. I will demonstrating how to connect Apache Directory Studio to an OpenLDAP server on a separate virtual machine. I will assume you already have your OpenLDAP server up and running.

Installing Apache Directory Studio

I will be demonstrating the installation of Apache Directory Studio on an instance of Ubuntu Linux 16.04. If you are using a different distribution, you will have to adjust accordingly.

The first thing you must know is that Apache Directory Studio is a graphical application written in Java. To that end, you must first install the Java JDK8. To do this, follow these steps:

  1. Open up a terminal window

  2. Add the necessary repository with the command sudo add-apt-repository ppa:webupd8team/java

  3. Update apt with the command sudo apt update

  4. Install Java by issuing the command sudo apt install oracle-java8-installer

  5. Accept the license agreement

  6. Set the Java environment variables with the command sudo apt install oracle-java8-set-default

That’s it. You can now test to ensure Java is installed with the command javac -version (Figure 1).

Now you can move on to downloading and running the Apache Directory Studio. There is no actual installation from this point on. Instead, you download the file, unpack it, and run the executable. Because there is no installation process, you will want to save the file in a location that is convenient and offers your user read/write/execution privileges. Here are the steps:

  1. Download the Apache Directory Studio tar file from the official Apache site

  2. Save the file to the chosen location

  3. Open a terminal window

  4. Change into the chosen directory

  5. Unpack the downloaded file with the command tar xvzf ApacheDirectoryStudio-XXX.yyy.tar.gz (where XXX is the release number and yyy is either 32 or 64 bit)

  6. Change into the newly created ApacheDirectoryStudio directory with the command cd ApacheDirectoryStudio

  7. Start the software with the command ./ApacheDirectoryStudio

At this point, you should now see the Apache Directory Studio main window (Figure 2).

Connecting to an LDAP server

You are now ready to connect Apache Directory Studio to your LDAP server. Click File > New and then select LDAP Connection (Figure 3).

In the next window (Figure 4), you must enter the information for your LDAP server. Give it a name, enter the hostname (or IP address), port number, select the encryption method, and the provider. Once you’ve filled out that information, click Check Network Parameter to make sure everything is working properly.

Click Next and you will then be required to fill out the authentication information for your connection (Figure 5). Select the Authentication Method, Bind DN or user, Bind password, and then click Check Authentication.

If your LDAP server requires SASL or Kerberos to be configured, expand those options and fill them out. Once you’ve completed this window, click Next.

In the next window (Figure 6), you can specify additional parameters for browsing your LDAP directory. As with many of the other options, these will depend upon your needs and how your LDAP server was configured.

Finally you can specific parameters for editing entries on your LDAP server (Figure 7). Again, this will be determined by your needs and how you’ve setup your LDAP server.

When the LDAP Browser window opens (Figure 8), you can then click on your dc entry and start working with LDAP.

To work with LDAP, you will right-click on the right pane and select the option you want to use (such as creating a new Attribute — Figure 9).

Expand the dc= entry (in the left pane) and you can then start adding Users and Groups. Click on Users and then right-click ou=Users, select New, and you can then create from a long list of available object classes (Figure 10).

There you have it. You’ve successfully, installed, connected, and used the Apache Directory Studio to work with your existing LDAP server. You can now connect Apache Directory Studio to any of your LDAP servers and manage them all from a single point of entry.

For more information on using the Apache Directory Studio, take a look at the official user documentation.

Learn more about Linux through the free “Introduction to Linux” course from The Linux Foundation and edX.

An Introduction to Vim for Sysadmins |

Why, you ask, should anyone care about Vim? It’s complex, it’s so old it’s a fossil, and you like Kate/Leafpad/Geany/Gedit/Nano/Jed/Lime/Emacs/what-have-you, and the Linux world is cram-full of great text editors, so why bother with Vim?

The main reason it is included in nearly all Linux distributions. Sure, it is rather a desert island scenario to worry about being trapped on an unfamiliar system and you only have Vim to rescue yourself. It does happen. You will especially appreciate it when you have to work over a slow SSH session with high latency because Vim is chock-a-block with powerful single-key commands.

The other reason is it is a customizable powerhouse that rewards a bit of study and tweaking with a nice productivity boost. For example, if you have to tag XML or HTML documents Vim can enter both opening and closing tags with a single keystroke. Or enter blocks of text, such as copyright notices or URLs, with a single keystroke. Vim is so flexible you can make it do just about anything with a minimum number of keystrokes.

Distro Quirks

The ancestral vi is long gone, replaced eons ago by Vim — vi IMproved. Vim includes extensive documentation, unless your distro installs only vim-tiny, which strips out the documentation and other fripperies, which is another reason to know the basics without having to look them up.

Most distros symlink vi to Vim, so you should be able to start it with either vi or vim. However, on some distros, notably Ubuntu, vi starts Vim in vi-compatible mode, and it will behave like the ancestral vi. It will even tell you on the home screen:

Running in Vi compatible mode                                        
type :set nocp for Vim defaults

The biggest hassle with vi-compatible mode is you can’t use the arrow, home, end, page up, or page down keys for navigating your document without entering command mode. We’ll get to Vim’s modes in a moment; the short story is Vim is more comfortable to use than vi. There are two ways to return to normal Vim mode. One is to do what the home screen tells you: press the Escape key and type :set nocp, then press Enter.

To change this permanently create ~/.vimrc and enter this line:

set nocp

A third way is to start Vim with vim instead of vi. On Ubuntu use vim.tiny.

Remembering Vim Commands

Vim’s commands are mnemonic, so it’s not that farfetched that you will remember them. d = delete, y = yank or cut, p = paste, w = write, q = quit. Your hands never leave the keyboard, so you are fast and efficient.

Starting Vim

The biggest hurdle for new Vim users is its dual-mode system. It has a command mode for entering commands, and an input mode for typing your text. Vim starts up in command mode. Let’s start with basic usage.

  • vi opens a new empty document
  • vi [newfilename] opens and names a new document
  • vi [filename] opens an existing document
  • Press the i or Insert key to enter input mode
  • Press the Escape key to leave insert mode and enter command mode

When you are in input mode you can type and edit your text just like any other text editor. Navigate through your document with the arrow keys. Home goes to the beginning of the paragraph, and End goes to the end. Ctrl+Home goes to the beginning of your document and Ctrl+End goes to the end.

Compact Keyboards

If you find yourself stuck with a keyboard that does not have Home, End, or arrow keys, enter command mode:

  • j moves the cursor down one line
  • i moves the cursor up one line
  • G goes to the end of the document
  • gg goes to the beginning of the document
  • h moves the cursor to the left, one character at a time
  • l moves the cursor to the right, one character at a time

Saving Changes and Exiting

Now we come to the fun part: saving your changes and closing Vim.

Save your changes as you go by pressing the Escape key to enter command mode, and then type :w Enter. You will see a confirmation that says something like “newfilename” 7 lines, 40 characters written”.

:sav [filename] names a new document, or saves the file under a new name

To quit and save your changes, enter command mode and type :x Enter or :wq Enter.

:q Enter quits if you have already saved your changes.

If you try to quit with unsaved changes, Vim won’t let you. Make it obey with :q! Enter. (Or save your changes.)

Common Editing Functions

Some common command mode editing functions:

  • u toggles undo/redo.
  • r replaces the character under the cursor
  • x deletes a single character
  • dw deletes a single word, starting from the cursor
  • D deletes to the end of the line, starting from the cursor
  • dd cuts one line
  • Ndd cuts N lines; e.g. 3dd deletes three lines starting with the current line
  • yy copies one line
  • p pastes whatever has been cut or copied
  • :set number displays line numbers
  • :set nonumber turns off line numbering

Advanced Vim

This should be adequate for simple editing tasks like configuration files. To learn advanced Vim functions type :help Enter to see all the built-in documentation. I recommend starting with the tutor, which takes 30-60 minutes to complete. You can launch the tutor outside of Vim by entering the vimtutor command in your shell.

Learn more about Linux through the free “Introduction to Linux” course from The Linux Foundation and edX.

Linux Kernel 4.10 Comes with New Security Features » Linux Magazine

Linus Torvalds has released Linux kernel 4.10, code-named Anniversary Edition, which brings many new features, including support for new hardware. One of the most significant improvements is support for virtual GPU. “This release adds support for Intel GVT-g for KVM (a.k.a. KVMGT), a full GPU virtualization solution with mediated pass-through, starting from 4th generation Intel Core (Haswell) processors with Intel Graphics,” according to Kernelnewbies, “The capability of running native graphics driver inside a VM, without hypervisor intervention in performance critical paths, achieves a good balance among performance, feature, and sharing capability.”

The Linux kernel supports many filesystems, and with this release, it has improved support for some of these filesystems, including ext4, F2FS, XFS, OverlayFS, NFS, CIFS, UBIFS, BeFS, and LogFS.

The release has also improved support for ARM-powered devices, including Huawei Nexus 6P (Angler), LG Nexus 5X (Bullhead), Nexbox A1 and A95X Android TV boxes, the Pine64 development board based on Allwinner A64, the Globalscale Marvell ESPRESSOBin community board based on Armada 3700, and the Renesas “R-Car Starter Kit Pro” (M3ULCB) low-cost automotive board.

Announcing the release, Torvalds wrote on the Linux Kernel Mailing List (LKML): “On the whole, 4.10 didn’t end up as small as it initially looked. After the huge release that was 4.9, I expected things to be pretty quiet, but it ended up very much a fairly average release by modern kernel standards. So we have about 13,000 commits (not counting merges – that would be another 1200+ commits if you count those).”

It’s a big release, so it’s not possible to list all of the new features here. Please refer to the Kernelnewbies writeup for detailed information.

Source link