WHOIS And How It Is Used

WHOIS Lookup gives you the ability to look up any generic domain name. This will display all of the details associated with the site as well as the technical contact which includes your domain registrar. Before you can use, simply install the whois package

Before you can use, simply install the whois package

root@test-VirtualBox:/# apt-get install whois

Here is a simple text below, this will output information off google.

root@test-VirtualBox:/# whois google.de

The result of this output should give you the server information

Unable to lock the administration directory / Could not open lock file

This occurs because you are using a normal user account to run the installation. Simply install it using the sudo to install any package as a root user.

sudo apt-get update && sudo apt-get upgrade

The update and upgrade of the system will run now without errors

Cleaning Packages Laying Around in Linux

These commands might be different from the commands used in your Linux distribution. For Ubuntu: Use the commands below.

sudo apt-get autoremove
sudo apt-get clean
sudo apt-get autoclean

These commands are needed to remove packages (dependencies) laying on the system after a particular package has been uninstalled.

Cont. – Linux Cheat Sheet – The Linux Command Line

Cursor Movement Commands

CTRL-A = Move cursor to the beginning of the line.
CTRL-E = Move cursor to the end of the line.
CTRL-F = Move cursor forward one character; same as the right arrow key.
CTRL-B = Move cursor backward one character; same as the left arrow key.
ALT-F =  Move cursor forward one word.
ALT-B =  Move cursor backward one word.
CTRL-L = Clear the screen and move the cursor to the top left corner. The "clear" command does the same thing.

Deciding on the right FileSystem for your USB

image source: TechLog360

When you get a new USB drive and are about to format it before its first use, you may be wondering which of the available file systems is the best. Here are some of the most important considerations before choosing a filesystem for a USB drive

File System? A file system is a piece of software that controls how data on a media is stored and retrieved. A file system manages operations such as copying, moving, and deleting files on a drive.

A file system is different from an operating system in the sense, a file system runs on top of an operating system and depends on it for many operations. Each of the major operating systems (e.g. Windows, MacOS, Linux) can work with various file systems (natively or through third-party tools).

How Do You Plan to Use Your USB Drive?Basically, the most important considerations regarding your choice of a file system for your USB drive are which operating systems you plan to use it with and how large the files you will most likely transfer are.

If you will be using your USB media on Windows OS, then you can decide on FAT32, exFAT, or NTFS.
– FAT32 and NTFS run with Linux, too, but exFAT requires additional tools. If you will be using the drive on Linux devices only, you can add its native EXT 2, 3, or 4 to the mix.
– As for MacOS, it can natively run FAT 32, works with exFAT, too, but you will need additional tools for NTFS, and its native file system is HFS+ (and the latest APFS) not EXT.

As you see, FAT 32 and to some extent NTFS, are present on all major OS’. They are not interchangeable and have their differences,

3. FAT32 vs. exFAT vs. NTFS vs. HFS vs. EXT 2, 3, and 4:There are really many file systems out there, and if you are curious, you can try a few of them before you land on the familiar ones.

However, your choices for a USB file system basically boil down to these:

  • NTFS: This the default file system for Windows partitions. NTFS supports journaling, large file sizes, file compression, long file names, access control, etc. If you are functioning in a Windows-only environment, it’s safe to go with NTFS. Linux can also handle NTFS, and MacOS reads it but needs third party tools to write, so even if you are not in a Windows only environment, it’s still a good choice.
  • FAT32: FAT32 or File Allocation Table 32 is the file system that typically comes preinstalled on a USB drive. It was the Windows standard before NTFS. FAT32 is slower than NTFS, less secure, and has a 4GB limit per file, but it is widely recognized by all major operating systems. If you will be using the USB drive in a highly heterogeneous environment, and portability is your main concern, FAT32 is your option.
  • exFAT: exFAT or extended File Allocation Table, is the newer version of FAT32. It’s lightweight but doesn’t have journaling. It’s compatible with Microsoft and MacOS but needs additional tools with Linux. It doesn’t have the 4GB limit per file restriction like FAT32.
  • HFS+: The Hierarchical File System (HFS+) is the default file system in the macOS world. If you are going to use your USB drive on Mac devices mainly, choose this file system. HFS+ can be used with Windows and Linux, but if you need a multi-OS file system, you definitely have better choices.
  • EXT 2, 3, and 4: The extended file system is the native for Linux. Similarly to HFS+, you can use it with the other operating systems but it’s not your best option. Use this file system if you are using the USB device on Linux computers mainly.

Most of these USB file systems run with multiple operating systems, e.g. Windows, macOS, Linux, etc., – so usually your choice isn’t limited to just one USB file system. If you don’t have large files to deal with, you have even more options. If speed of transfer isn’t a top priority either, there are even more choices. And if it turns out your first choice of a USB file system wasn’t the best, you can always reformat the drive, provided there is no valuable data on it, of course. Source: Maketecheasier

Lightweight Directory Access Protocol (LDAP)

LDAP is a network protocol used to perform queries and changes in a distributed directory service. The protocol from the TCP / IP protocol stack is specified in the RFCs 4510, 4511 and 4532.

LDAP itself is not a directory, but a protocol with which one can retrieve information from an LDAP directory. LDAP requires that all participating systems be able to exchange data on port 389 for unsecured transmission and port 636 for secure connection (TLS).

The idea behind LDAP is simple: A directory in a tree structure distributed over different servers should be searchable. See the video below for more high level overview.

Source: Help Desk Premier

The tree structure of the directory is broadly defined. The origin is the “root directory” and this branches into various groups such as organisations, organisational units and individuals etc.

Note: The latter may be users, persons, printers, scanners, computers, servers as the case may be. Although the system allows a high degree of flexibility in the mapping of structures, the definition of the elements in the schema is rather strict. Here are some uses cases for LDAP.

  • User administration
  • System administration
  • Protocol
  • NIS information
  • Boot information
  • File system mount point management
  • Organisation of alias names in e-mail systems
  • Administration of DNS zone data
  • Organisation of DHCP servers

LDAP implementation in Active Directory
LDAP is widely implemented in Microsoft Active Directory (AD) and it is the fourth major component of Active Directory. Other components are Kerberos, CIFS, and DNS. In Active Directory environment, the LDAP directory provides information about users, computers, and their group membership. But other objects, such as the certificates of a computer, are stored in the directory.

LDAP basic structure is simple. LDAP consists of objects and follows largely the approach of object-oriented programming with classes, inheritance, polymorphism and the objects themselves. A directory service entry consists of a list of attributes and a “mandatory object” – the name of the object itself, the “Distinguished Name”.

This name is similar to a filename and shares the same property with the filename convention: it is not possible to have the same name in the same level. Objects named “OU” represent containers in which other objects can be created. Here are some attributes used with LDAP.

CN: commonName 
L: localityName
ST: stateOrProvinceName
O: organisationName
OU: organisationalUnitName
C: countryName
STREET: streetAddress
DC: domainComponent
UID: userid

At first glance, this seems to be rather ambiguous, confusing and complex. Lets go into details and try to make sense of these attributes.

Let’s say an Active Directory is named techdirectarchive.local and a new user with the name “Martin, brown” is created while the selection on the root directory techdirectarchive.local is created. Here is how the attribute would look like.

CN = Martin brown, DC =  techdirectarchive, DC = local

Now the object is moved to an Organisation Unit (OU) with the title “persons” and the DN is looked at again:

CN = Martin brown, OU = persons, DC = techdirectarchive, DC = local

Within the OU people, another OU for better grouping of users due to job roles. This should be called “Accounting Employees” and the user object of Martin brown is assigned to this new OU. Thus, the DN is:

CN = Martin brown, OU = Accounting Employees, OU = persons, DC = techdirectarchive, DC = local

Now the logic is almost automatic. The commonName , the name of the object itself, is on the left side, while the assignment from the right side starts with the domain structure local , followed by techdirectarchive.

Conveniently, there are a large number of programs that can query a directory structure using LDAP; For Microsoft Windows, for example, the “LDAP Admin” by T. Karlovic is a compact and practical solution. On the other hand, there are many script variants to determine information via LDAP. Below is the PowerShell script:

$ strFilter = "(& (objectCategory = User))" 
$ objDomain = New-Object System.DirectoryServices.DirectoryEntry 
$ objSearcher = New-Object System.DirectoryServices.DirectorySearcher 
$ objSearcher.SearchRoot = $ objDomain 
$ objSearcher. PageSize = 1000 
$ objSearcher.Filter = $ strFilter 
$ objSearcher.SearchScope = "Subtree" 
$ colProplist = "name" 
foreach ($ i in $ colPropList) {$ objSearcher.PropertiesToLoad.Add ($ i)} 
$ colResults = $ objSearcher. FindAll () 
foreach ($ objResult in $ colResults) 
  {$ objItem = $ objResult.Properties; $ objItem.name}

It returns the usernames of the employees from the department (see first line department = editorial ). If the script is looking for something else, for example, employees whose login names contain a special sequence of letters, the first line looks something like this:

$ strFilter = "(& (objectCategory = User) (sAMAccountName = Me *))"

The asterisk behind “Me” acts as a wildcard here. The lower part of this PS command sequence (from the Microsoft homepage) can therefore be used quite well for other purposes. But, it’s also much, much easier – with a one-liners in the PowerShell:

Get-ADUser filter {Name -Like "*"} -Searchbase "OU = PEOPLE, DC = techdirectarchive, DC = local"

For example, if the administrator wants to read out the phone numbers, this one command will expand a bit:

Get-ADUser -filter {Surname -Like "*"} -properties cn, telephoneNumber -SearchScope Subtree-SearchBase "OU = People, DC = techdirectarchive, DC = local" | select-object Surname, Givenname, telephoneNumber

Surname is the surname here, while Givenname represents the first name.

For more training on LDAP, please watch this video below.

And See the following link https://help.ubuntu.com/lts/serverguide/openldap-server.html for more information on LDAP. Source: ip-insider

Access EC2 Linux Instance via the Password

Default username for CentOS instance (on AWS) is: centos

Note: In CentOS use,

  • sudo su in changing to a root user or
  • Sudo su <username>

Step 1
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/putty.html
After creating an instance start the PuttyKeyGen
Click on Load

By default, PuTTYgen displays only files with the extension .ppk. To locate your .pem file, select the option to display files of all types.

Now you should be able to view the keyfile download from the instance containing the public.

Choose Save private key to save the key in the format that PuTTY can use. PuTTYgen displays a warning about saving the key without a passphrase. Choose Yes.

Step 2
Open Putty
Enter the connection name or IP and select port 22

 

To have the private key entered,
Expand Connection, expand SSH, and then choose Auth and choose Browse.

Now click on Open, you should be able to access the server. The default username for CentOS is centos

Steps 3:
To create a password for this user, edit the sshd_config setting and save it

vi /etc/ssh/sshd_config
change the PasswordAuthentication value as yes

PasswordAuthentication yes

:wq (means save and exit)

Step 4:
Restart the SSH service
service sshd restart
or
/etc/init.d/sshd restart
https://serverfault.com/questions/253464/enable-password-login-for-ssh-on-amazon-linux-ami

http://sharadchhetri.com/2013/03/29/how-to-enable-direct-ssh-to-ec2-linux-instance-without-keypair-file/

Step 5:

To add a user account in order to connect to the EC2 instance via a username and password on CentOS

Step A: To add a user to the system, issue the useradd command to create a locked user account:
#useradd <username>

Step B: Unlock the account by issuing the passwd command to assign a password and set password aging guidelines:
passwd <username>
This must be the same user name in step A above. After this criteria has been met, then you should be able to set the password

Now: Connect a new session and test with the user account created.
https://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-users-add.html

 

Adding a user as a Sudoer on CentOS

Because certain action can only be performed by Linux Administrators on Linux, this makes the root by default have access to whatsoever on the Linux Machine. Since we have the root user account disabled, we will create a new user account and add the user to the Sudoer file thereby granting him all privileges he needs.

Procedure

Steps 1: First Create a user account and the steps can be found in this document above

Step 2: The file in Linux that determines if you are eligible to execute the Sudo is called “Sudoers” and this can be found in this location /etc/sudoers

But it is not recommended to modify this file as it is detrimental! Why is it so? This is because any syntax error found in this file could affect the entire system. So there is a unique used called visudo

[root@ip-11.1.1.22]# visudo
After running this comment, use “i” to insert and search for the file (this will prompt the sudoer file for editing (modification)
## Allow root to run any commands anywhere

Below this you will see lines like (Add the username and permission as the root user) as shown in the screenshot below, e.g,
                              [username]     ALL=(ALL)        ALL

This is all.

 

Question? What is visudo?
The sudo command is configured through a file located at /etc/sudoers

https://www.webhostinghero.com/add-a-user-to-sudoers-in-centos-linux/