Thursday, 24 May 2018

SCP Command Examples - Linux / Unix

SCP Command, LPI Tutorials and Material, LPI Certifications, LPI Linux / Unix, LPI SSH

SCP stands for secure copy is used to copy data (files or directories) from one unix or linux system to another unix or linux server. SCP uses secured shell (ssh) to transfer the data between the remote hosts. The features of SCP are:

◈ Copies files within in the same machine
◈ Copies files from local machine to remote machine.
◈ Copies files from remote machine to local machine.
◈ Copies files between two different remote servers.

SCP Command Syntax:


The syntax of SCP command is

scp [Options] [[User@]From_Host:]Source_File [[User@]To_Host:][Destination_File]

Each element of the scp command is explained in detail below:

◈ User is the one who have the permissions to access the files and directories. User should have read permissions if it is a source and write permissions if it is the destination.
◈ From_Host: hostname or Ip address where the source file or directory resides. This is optional if the from host is the host where you are running the scp command.
◈ Source_File: Files or directories to be copied to the destination.
◈ To_Host: Destination host where you want to copy the files. You can omit this when you want to copy the files to the host where you are issuing the scp command.
◈ Destination_File: Name of the file or directory in the target host.

SCP Command Options:


The important SCP command options are listed below:

◈ -r : Recursively copies the contents of source files or directories.
◈ -p : Preserves the access time, modification time, permissions of the source files in the destination.
◈ -q : Progress bar in not displayed
◈ -v : verbose mode. Displays debugging messages.
◈ -P : copy files using the specified port number.

SCP Command Examples:


Let see the examples of scp command in unix or linux system.

1. Copying with in the same system


You can use the scp command just like the cp command to copy files from one directory to another directory.

scp Unix-storage.dat /var/tmp/

This command copies the file unix-storage.dat from current directory to the /var/tmp directory.

2. Copy file from local host to remote server


This is most frequently used operation to transfer files in unix system.

scp filename user@remotehost:/remote/directory/

This command connects to the remote host and copies the specified file to the /remote/directory/.

3. Copy files from remote host to local server.


This operation is used when taking backup of the files in remote server.

scp user@remotehost:/usr/backup/oracle_backup.dat.

This command copies the oracle backup file in the remote host to the current directory.

4. Copying files between two remote servers


The scp command can also be used to copy files between two remote hosts.

scp source_user@source_remote_host:/usr/bin/mysql_backup.sh target_user@target_remote_host:/var/tmp/

The above command copies the mysql bakup shell script from the source remote host the /var/tmp directory of target remote host.

5. Copying a directory.


To copy all the files in a directory, use the -r option with the scp command. This makes the scp command to copy the directory recursively.

scp -r directory user@remotehost:/var/tmp/

The above command copies the directory from local server to the remote host.


6. Improving performance of scp command


By default the scp command uses the Triple-DES cipher/AES-128 to encrypt the data. Using the blowfish or arcfour encryption will improve the performance of the scp command.

scp -c blowfish filename  user@remoteserver:/var/
scp -c arcfour  localfile user@remoteserver:/var/

7. Limit bandwidth


You can limit the bandwidth used by the scp command using the -l option.

scp -l bandwidth_limit filename user@hostname:/usr/backup/
Here bandwidth_limit is numeric to be specified in kilobits per second.

8. Specifying the port number


We can make the scp command to copy the files over a specified port number using the -P option.

scp -P 6001 storage_backup.bat username@hostname:/tmp/

Tuesday, 22 May 2018

Earn your LPIC-1 Linux Administrator certification for free!

LPIC-1 Certifications, LPIC-1, LPIC-1 Tutorials and Materials

The Linux Professional Institute (LPI) has updated the objectives for LPIC-1 and are looking for a limited number of qualified volunteers to participate in free beta exams, between May 21 - June 30, 2018, in order to help with our quality assurance process.

The Linux Professional Institute (LPI) is organizing events worldwide that offer an opportunity, eligible to anyone, to take their LPIC-1 beta exams, join the LPI Exam Development Community, and advance your professional credentials.

LPI is committed to the development of global standards and certifications in Linux and open source innovation. A community of Linux professionals, volunteers, vendors, and educators design the LPI Certification Program that unites the requirements of both IT professionals and the organizations that would employ them.

About the LPIC-1 Linux Administrator Certification


LPIC-1 is the first certification in LPI’s multi-level Linux professional certification program. The LPIC-1 will validate the candidate's ability to perform maintenance tasks on the command line, install and configure a computer running Linux and configure basic networking.

The LPIC-1 is designed to reflect current research and validate a candidate's proficiency in real world system administration. The objectives are tied to real-world job skills, which we determine through job task analysis surveying during exam development. To become LPIC-1 certified, the candidate must be able to:

◈ understand the architecture of a Linux system;
◈ install and maintain a Linux workstation or cloud instance, including setup up as a network client;
◈ work at the Linux command line, including common GNU and Unix commands;
◈ handle files and access permissions as well as system security; and
◈ perform easy maintenance tasks: help users, add users to a larger system, backup and restore, shutdown and reboot.

About the LPIC-1 Beta Exams (Version 5.0)


Beta exams are organized in the English language only, and will be delivered as paper based tests (PBT). Both exams, 101 and 102, each take 90 minutes and contain 60 questions. They are offered free of charge. Passing the exams for 101 and 102 leads to the LPIC-1 System Administrator certification.

In addition, beta candidates will be asked to answer a short survey and provide feedback on the exam content. For this purpose, LPI Exam Development team members may visit beta exam labs to collect direct feedback from the candidates.

Candidates should be aware that beta exams cover the new version of the objectives which will contain new exam material. Their passed exams are counted as regular exams and can be used to achieve a certification. Failed exams can be deleted from the candidate’s profile on their request.

How to prepare for the LPIC-1 Beta Exams


Candidates can find updated exam objectives for the new LPIC-1 101 and 102 (Version 5.0) on the LPI Wiki Resources website: https://wiki.lpi.org/wiki/LPIC-1_Summary_Version_4.0_To_5.0

About the Linux Professional Institute (LPI)


LPI is the global certification standard and career support organization for open source professionals. With more than 600,000 exams delivered, it's the world's first and largest vendor-neutral Linux and open source certification body. LPI has certified professionals in over 180 countries, delivers exams in 9 languages, and has over 400 training partners.

Saturday, 19 May 2018

bc Command Examples in Unix / Linux

Linux Command, Linux Tutorials and Materials, LPI Certifications, LPI Guides

Arithmetic operations are the most common in any kind of programming language. Unix or linux operating system provides the bc command and expr command for doing arithmetic calculations. You can use these commands in bash or shell script also for evaluating arithmetic expressions.

Here we will see only about the bc command. The bc command evaluates expressions similar to the c programming language. The bc command supports the following features.

◈ Arithmetic operators
◈ Increment and decrement operators
◈ Assignment operators
◈ Comparision or Relational Operators
◈ Logical or Boolean operators
◈ Math Functions
◈ Conditional statements
◈ Iterative statements
◈ Functions

Arithmetic operator Examples:


The following example shows how to use various arithmetic operators. The examples are pretty straight forward. So, I will provide explanation only when required. In most of the examples the echo statment is used to provide the expressions to the bc command.

1. Finding Sum of Two expressions 

> echo "2+5" | bc
7

2. Difference of Two numbers

> echo "10-4" | bc
6

3. Multiplying two numbers

> echo "3*8" | bc
24

4. Dividing two numbers 

When you divide two numbers, the bc command Ignores the decimal part and returns only the integral part as the output. See the below examples

> echo "2/3" | bc
0

> echo "5/4" | bc
1

Use the scale function to specify the number of decimal digits that the bc command should return.

> echo "scale=2;2/3" | bc
.66

5. Finding the remainder using modulus operator

> echo "6%4" | bc
2

6. Using exponent operator

> echo "10^2" | bc
100

Here the expression is evaluated as 10 to the power of 2.

Assignment Operator Examples: 


Assignment operators are used to assign a value to the variable. The following example shows how to use the assignment operators:

Assigns 10 to the variable and prints the value on the terminal.
> echo "var=10;var" | bc

Increment the value of the variable by 5
> echo "var=10; var+=5;var | bc
15

The lists of assignment operators supported are:
◈ var = value   : Assign the value to the variable
◈ var += value : similar to var = var + value
◈ var -= value  : similar to var = var - value
◈ var *= value  : similar to var = var * value
◈ var /= value   : similar to var = var / value
◈ var ^= value  : similar to var = var ^ value
◈ var %= value : similar to var = var % value

Increment Operator Examples: 


There are two kinds of increment operators. They are pre increment and post increment operators.

◈ ++var : Pre increment operator. The variable is incremented first and then the result of the variable is used.
◈ var++ : Post increment operator. The result of the variable is used first and then the variable is incremented.

> echo "var=5;++var" | bc
6

> echo "var=5;var++" | bc
5

Here, in the second example the value of var is printed first and then it is incremented. See the below example, to see the complete incremental effect.

> echo "var=5;var++;var" | bc
5
6

Decrement Operator Examples: 


Similar to the increment operators, there are two types of decrement operators.

◈ --var : Pre decrement operator. The variable is decremented first and then the result of the variable is used.
◈ var-- : Post decrement operator. The result of the variable is used first and then the variable is decremented.

> echo "var=5;--var"| bc
4
> echo "var=5;var--"| bc
5

Relational Operators Examples: 


Relational operators are used to compare two numbers. If the comparison is true, then it returns 1. Otherwise (false), it returns 0. The relational operators are mostly used in conditional statements like if. The list of relational operators supported in bc command are shown below:

◈ expr1 < expr2 : Result is 1 if expr1 is strictly less than expr2.
◈ expr1 <= expr2 : Result is 1 if expr1 is less than or equal to expr2.
◈ expr1 > expr2 : Result is 1 if expr1 is strictly greater than expr2.
◈ expr1 >= expr2 : Result is 1 if expr1 is greater than or equal to expr2.
◈ expr1 == expr2 : Result is 1 if expr1 is equal to expr2.
◈ expr1 != expr2 : Result is 1 if expr1 is not equal to expr2.

> echo "10 > 5" | bc
1

> echo "1 == 2" | bc
0

Logical Operator Examples:


Logical operators are also mostly used in conditional statements. The result of the logical operators is either 1 (True) or 0 (false) ! expr : Result is 1 if expr is 0.

◈ expr && expr : Result is 1 if both expressions are non-zero.
◈ expr || expr : Result is 1 if either expression is non-zero.

> echo "4 && 10" | bc
1
> echo "0 || 0" | bc
0

Math Functions: 


The built-in math functions supported are:

◈ s (x) : The sine of x, x is in radians.
◈ c (x) : The cosine of x, x is in radians.
◈ a (x) : The arctangent of x, arctangent returns radians.
◈ l (x) : The natural logarithm of x.
◈ e (x) : The exponential function of raising e to the value x.
◈ j (n,x): The bessel function of integer order n of x.
◈ sqrt(x): Square root of the number x.

In addition to the math functions, the following functions are also supported.

◈ length(x) : returns the number of digits in x
◈ read() : Reads the number from the standard input.

Conditional Statement Examples: 


Conditional statements are used to take decisions and execute statements based on these decisions. Bc command supports the if condition. The syntax of if statement is

if(condition) { statements} else {statements}

The following example shows show to use the if condition

> echo 'if(1 == 2) print "true" else print "false"' | bc
false

Iterative Statements:


Bc command supports the for and while loop for doing iterations. The syntax of for and while loop are shown below:

for (assignment; condition; increment) {
statements
}

while (condition) {
statements
}

The following examples prints numbers from 1 to 10 using the for and while loops

> echo "for(i=1;i<=10;i++) {i;}" | bc
> echo "i=1; while(i<=10) { i; i+=1}" | bc

Functions: 


A function is a code block which executes logically related functionality and returns a value. The syntax of creating a function is

define function-name(comma separated parameters list) {
statements
return statement
}

So far we have provided the arithmetic expressions to the bc command by using the echo statement. We can write these arithmetic expressions in a file and then execute those statements by providing the filename to the bc command. This is shown below:

> cat arth_expr.dat
2+5;
var = 10*3
var
print var
define sum(a,b) {
return a+b
}
sum(3,5)
quit

Now see how to execute these statements:

> bc arth_expr.dat
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
7
30
30
8

Be default the bc command prints the welcome message(version, copyright message. You can suppress this welcome message by using the -q option with bc command

> bc -q arth_expr.dat

Important Points: 


◈ Bc command treats the semicolon (;) or newline as the statement separator.

◈ To group statements use the curly braces. Use with functions, if statement, for and while loops.

◈ If only an expression is specified as a statement, then bc command evaluates the expression and prints the result on the standard output.

◈ If an assignment operator is found. Bc command assigns the value to the variable and do not print the value on the terminal.

◈ A function should be defined before calling it. Always the function definition should appear first before the calling statements.

◈ If a standalone variable is found as a statement, bc command prints the value of the variable. You can also Use the print statement for displaying the list of values on the terminal.

Thursday, 17 May 2018

Change Directory (cd) Examples | Unix and Linux Command

Unix and Linux Command, LPI Tutorials and Materials, LPI Guides, LPI Learning

The Change directory (cd) command is one of the simple commands in Unix (or Linux) and it is very easy to use. The cd command is used to change from the current directory to another directory. The syntax of cd command is

cd [directory]
Here directory is the name of the directory where you wish to go.

CD Command Examples


1. Write a unix/linux cd command to change to home directory?


Just simply type cd command on the unix terminal and then press the enter key. This will change your directory to home directory.

> pwd
/usr/local/bin

Now i am in the /usr/local/bin directory. After typing the cd command and unix window, you will go to your home directory.

> cd
> pwd
/home/matt

Here pwd command displays the present working directory.

2. Write a unix/linux cd command to go back to one directory?


The cd .. changes the directory to its parent directory by going back one level. The space between the cd and .. is must.

> pwd
/var/tmp
> cd ..
> pwd
/var

3. Write a unix/linux cd command to go back to two directories?


The cd ../../ takes you back to two directories. You can extend this cd command to go back to n number of directories.

> pwd
/usr/local/bin
> cd ../../
> pwd
/usr

4. Write a unix/linux cd command to change the directory using the absolute path?


In case of changing directory using absolute path you have to specify the full directory path. Absolute path directories always start with a slash (/). An example is changing your directory to /usr/bin from your home directory.

> cd /usr/bin

5. Write a unix/linux cd command to change the directory using the relative path?


In relative path, you have to specify the directory path relative to your current directory. For example, you are in /var/tmp directory and you want to go to /var/lib directory, then you can use the relative path.

> pwd
/var/tmp
> cd ../lib
> pwd
/var/lib

Here the cd ../lib, first takes you to the parent directory which is /var and then changes the directory to the lib.

6. Write a unix/linux cd command to change back to previous directory.


As an example, i am in the directory /home/matt/documents and i changed to a new directory /home/matt/backup. Now i want to go back to my previous directory /home/matt/documents. In this case, you can use the cd - command to go back to the previous directory.

> pwd
/home/matt/documents
> cd /home/matt/backup
>pwd
/home/matt/backup
> cd -
> pwd
/home/matt/documents

Tuesday, 15 May 2018

Uniq Command Examples in Unix and Linux

LPI Tutorials and Materials, LPI Guides, LPI Learning, LPI Certifications

Uniq command in unix or linux system is used to suppress the duplicate lines from a file. It discards all the successive identical lines except one from the input and writes the output.

The syntax of uniq command is

uniq [option] filename

The options of uniq command are:

◈ c : Count of occurrence of each line.
◈ d : Prints only duplicate lines.
◈ D : Print all duplicate lines
◈ f : Avoid comparing first N fields.
◈ i : Ignore case when comparing.
◈ s : Avoid comparing first N characters.
◈ u : Prints only unique lines.
◈ w : Compare no more than N characters in lines

Uniq Command Examples:


First create the following example.txt file in your unix or linux operating system.

> cat example.txt
Unix operating system
unix operating system
unix dedicated server
linux dedicated server

1. Suppress duplicate lines 


The default behavior of the uniq command is to suppress the duplicate line. Note that, you have to pass sorted input to the uniq, as it compares only successive lines.

> uniq example.txt
unix operating system
unix dedicated server
linux dedicated server

If the lines in the file are not in sorted order, then use the sort command and then pipe the output to the uniq command.

> sort example.txt | uniq

2. Count of lines. 


The -c option is used to find how many times each line occurs in the file. It prefixes each line with the count.

> uniq -c example.txt
      2 unix operating system
      1 unix dedicated server
      1 linux dedicated server

3. Display only duplicate lines. 


You can print only the lines that occur more than once in a file using the -d option.

> uniq -d example.txt
unix operating system

> uniq -D example.txt
unix operating system
unix operating system

The -D option prints all the duplicate lines.

4. Skip first N fields in comparison. 


The -f option is used to skip the first N columns in comparison. Here the fields are delimited by the space character.

> uniq -f2 example.txt
unix operating system
unix dedicated server

In the above example the uniq command, just compares the last fields. For the first two lines, the last field contains the string "system". Uniq prints the first line and skips the second. Similarly it prints the third line and skips the fourth line.

5. Print only unique lines. 


You can skip the duplicate lines and print only unique lines using the -u option

> uniq -u example.txt
unix dedicated server
linux dedicated server

Thursday, 10 May 2018

Objectives: LPIC-3 Exam 300 (Mixed Environments)

LPIC-3 Exam 300, LPIC-3 Certifications, LPIC-3 Tutorials and Materials

Exam Objectives Version: Version 1.0

Exam Code: 300-100

About Objective Weights: Each objective is assigned a weighting value. The weights indicate the relative importance of each objective on the exam. Objectives with higher weights will be covered in the exam with more questions.

Exam Topics


Topic 390: OpenLDAP Configuration


390.1 OpenLDAP Replication

Description: Candidates should be familiar with the server replication available with OpenLDAP.

Weight: 3

Key Knowledge Areas:

◈ Replication concepts
◈ Configure OpenLDAP replication
◈ Analyze replication log files
◈ Understand replica hubs
◈ LDAP referrals
◈ LDAP sync replication

The following is a partial list of the used files, terms and utilities:

◈ master / slave server
◈ multi-master replication
◈ consumer
◈ replica hub
◈ one-shot mode
◈ referral
◈ syncrepl
◈ pull-based / push-based synchronization
◈ refreshOnly and refreshAndPersist
◈ replog

390.2 Securing the Directory

Description: Candidates should be able to configure encrypted access to the LDAP directory, and restrict access at the firewall level.

Weight: 3

Key Knowledge Areas:

◈ Securing the directory with SSL and TLS
◈ Firewall considerations
◈ Unauthenticated access methods
◈ User / password authentication methods
◈ Maintanence of SASL user DB
◈ Client / server certificates

Terms and Utilities:

◈ SSL / TLS
◈ Security Strength Factors (SSF)
◈ SASL
◈ proxy authorization
◈ StartTLS
◈ iptables

390.3 OpenLDAP Server Performance Tuning

Weight: 2

Description: Candidates should be capable of measuring the performance of an LDAP server, and tuning configuration directives.

Key Knowledge Areas:

◈ Measure OpenLDAP performance
◈ Tune software configuration to increase performance
◈ Understand indexes

Terms and Utilities:

◈ index
◈ DB_CONFIG

Topic 391: OpenLDAP as an Authentication Backend


391.1 LDAP Integration with PAM and NSS

Weight: 2

Description: Candidates should be able to configure PAM and NSS to retrieve information from an LDAP directory.

Key Knowledge Areas:

◈ Configure PAM to use LDAP for authentication
◈ Configure NSS to retrieve information from LDAP
◈ Configure PAM modules in various Unix environments

Terms and Utilities:

◈ PAM
◈ NSS
◈ /etc/pam.d/
◈ /etc/nsswitch.conf

391.2 Integrating LDAP with Active Directory and Kerberos

Weight: 2

Description: Candidates should be able to integrate LDAP with Active Directory Services.

Key Knowledge Areas:

◈ Kerberos integration with LDAP
◈ Cross platform authentication
◈ Single sign-on concepts
◈ Integration and compatibility limitations between OpenLDAP and Active Directory

Terms and Utilities:

◈ Kerberos
◈ Active Directory
◈ single sign-on
◈ DNS

Topic 392: Samba Basics


392.1 Samba Concepts and Architecture

Weight: 2

Description: Candidates should understand the essential concepts of Samba. As well, the major differences between Samba3 and Samba4 should be known.

Key Knowledge Areas:

◈ Understand the roles of the Samba daemons and components
◈ Understand key issues regarding heterogeneous networks
◈ Identify key TCP/UDP ports used with SMB/CIFS
◈ Knowledge of Samba3 and Samba4 differences

The following is a partial list of the used files, terms and utilities:

◈ /etc/services
◈ Samba daemons: smbd, nmbd, samba, winbindd

392.2 Configure Samba

Weight: 4

Description: Candidates should be able to configure the Samba daemons for a wide variety of purposes.

Key Knowledge Areas:

◈ Knowledge of Samba server configuration file structure
◈ Knowledge of Samba variables and configuration parameters
◈ Troubleshoot and debug configuration problems with Samba

Terms and Utilities:

◈ smb.conf
◈ smb.conf parameters
◈ smb.conf variables
◈ testparm
◈ secrets.tdb

392.3 Regular Samba Maintenance

Weight: 2

Description: Candidates should know about the various tools and utilities that are part of a Samba installation.

Key Knowledge Areas:

◈ Monitor and interact with running Samba daemons
◈ Perform regular backups of Samba configuration and state data

Terms and Utilities:

◈ smbcontrol
◈ smbstatus
◈ tdbbackup

392.4 Troubleshooting Samba

Weight: 2

Description: Candidates should understand the structure of trivial database files and know how troubleshoot problems.

Key Knowledge Areas:

◈ Configure Samba logging
◈ Backup TDB files
◈ Restore TDB files
◈ Identify TDB file corruption
◈ Edit / list TDB file content

Terms and Utilities:

◈ /var/log/samba/
◈ log level
◈ debuglevel
◈ smbpasswd
◈ pdbedit
◈ secrets.tdb
◈ tdbbackup
◈ tdbdump
◈ tdbrestore
◈ tdbtool

392.5 Internationalization

Weight: 1

Description: Candidates should be able to work with internationalization character codes and code pages.

Key Knowledge Areas:

◈ Understand internationalization character codes and code pages
◈ Understand the difference in the name space between Windows and Linux/Unix with respect to share, file and directory names in a non-English environment
◈ Understand the difference in the name space between Windows and Linux/Unix with respect to user and group naming in a non-English environment
◈ Understand the difference in the name space between Windows and Linux/Unix with respect to computer naming in a non-English environment

Terms and Utilities:

◈ internationalization
◈ character codes
◈ code pages
◈ smb.conf
◈ dos charset, display charset and unix charset

Topic 393: Samba Share Configuration


393.1 File Services

Weight: 4

Description: Candidates should be able to create and configure file shares in a mixed environment.

Key Knowledge Areas:

◈ Create and configure file sharing
◈ Plan file service migration
◈ Limit access to IPC$
◈ Create scripts for user and group handling of file shares
◈ Samba share access configuration parameters

Terms and Utilities:

◈ smb.conf
◈ [homes]
◈ smbcquotas
◈ smbsh
◈ browseable, writeable, valid users, write list, read list, read only and guest ok
◈ IPC$
◈ mount, smbmount

393.2 Linux File System and Share/Service Permissions

Weight: 3

Description: Candidates should understand file permissions on a Linux file system in a mixed environment.

Key Knowledge Areas:

◈ Knowledge of file / directory permission control
◈ Understand how Samba interacts with Linux file system permissions and ACLs
◈ Use Samba VFS to store Windows ACLs

Terms and Utilities:

◈ smb.conf
◈ chmod, chown
◈ create mask, directory mask, force create mode, force directory mode
◈ smbcacls
◈ getfacl, setfacl
◈ vfs_acl_xattr, vfs_acl_tdb and vfs objects

393.3 Print Services

Weight: 2

Description: Candidates should be able to create and manage print shares in a mixed environment.

Key Knowledge Areas:

◈ Create and configure printer sharing
◈ Configure integration between Samba and CUPS
◈ Manage Windows print drivers and configure downloading of print drivers
◈ Configure [print$]
◈ Understand security concerns with printer sharing
◈ Uploading printer drivers for Point’n’Print driver installation using ‘Add Print Driver Wizard’ in Windows

Terms and Utilities:

◈ smb.conf
◈ [print$]
◈ CUPS
◈ cupsd.conf
◈ /var/spool/samba/.
◈ smbspool
◈ rpcclient
◈ net

Topic 394: Samba User and Group Management


394.1 Managing User Accounts and Groups

Weight: 4

Description: Candidates should be able to manage user and group accounts in a mixed environment.

Key Knowledge Areas:

◈ Manager user and group accounts
◈ Understand user and group mapping
◈ Knowledge of user account management tools
◈ Use of the smbpasswd program
◈ Force ownership of file and directory objects

Terms and Utilities:

◈ pdbedit
◈ smb.conf
◈ samba-tool user (with subcommands)
◈ samba-tool group (with subcommands)
◈ smbpasswd
◈ /etc/passwd
◈ /etc/group
◈ force user, force group.
◈ idmap

394.2 Authentication, Authorization and Winbind

Weight: 5

Description: Candidates should understand the various authentication mechanisms and configure access control. Candidates should be able to install and configure the Winbind service.

Key Knowledge Areas:

◈ Setup a local password database
◈ Perform password synchronization
◈ Knowledge of different passdb backends
◈ Convert between Samba passdb backends
◈ Integrate Samba with LDAP
◈ Configure Winbind service
◈ Configure PAM and NSS

Terms and Utilities:

◈ smb.conf
◈ smbpasswd, tdbsam, ldapsam
◈ passdb backend
◈ libnss_winbind
◈ libpam_winbind
◈ libpam_smbpass
◈ wbinfo
◈ getent
◈ SID and foreign SID
◈ /etc/passwd
◈ /etc/group

Topic 395: Samba Domain Integration


395.1 Samba as a PDC and BDC

Weight: 3

Description: Candidates should be able to setup and maintain primary and backup domain controllers. Candidates should be able to manage Windows/Linux client access to the NT-Style domains.

Key Knowledge Areas:

◈ Understand and configure domain membership and trust relationships
◈ Create and maintain a primary domain controller with Samba3 and Samba4
◈ Create and maintain a backup domain controller with Samba3 and Samba4
◈ Add computers to an existing domain
◈ Configure logon scripts
◈ Configure roaming profiles
◈ Configure system policies

Terms and Utilities:

◈ smb.conf
◈ security mode
◈ server role
◈ domain logons
◈ domain master
◈ logon script
◈ logon path
◈ NTConfig.pol
◈ net
◈ profiles
◈ add machine script
◈ profile acls

395.2 Samba4 as an AD compatible Domain Controller

Weight: 3

Description: Candidates should be able to configure Samba 4 as an AD Domain Controller.

Key Knowledge Areas:

◈ Configure and test Samba 4 as an AD DC
◈ Using smbclient to confirm AD operation
◈ Understand how Samba integrates with AD services: DNS, Kerberos, NTP, LDAP

Terms and Utilities:

◈ smb.conf
◈ server role
◈ samba-tool domain (with subcommands)
◈ samba

395.3 Configure Samba as a Domain Member Server

Weight: 3

Description: Candidates should be able to integrate Linux servers into an environment where Active Directory is present.

Key Knowledge Areas:

◈ Joining Samba to an existing NT4 domain
◈ Joining Samba to an existing AD domain
◈ Ability to obtain a TGT from a KDC

Terms and Utilities:

◈ smb.conf
◈ server role
◈ server security
◈ net command
◈ kinit, TGT and REALM

Topic 396: Samba Name Services


396.1 NetBIOS and WINS

Weight: 3

Description: Candidates should be familiar with NetBIOS/WINS concepts and understand network browsing.

Key Knowledge Areas:

◈ Understand WINS concepts
◈ Understand NetBIOS concepts
◈ Understand the role of a local master browser
◈ Understand the role of a domain master browser
◈ Understand the role of Samba as a WINS server
◈ Understand name resolution
◈ Configure Samba as a WINS server
◈ Configure WINS replication
◈ Understand NetBIOS browsing and browser elections
◈ Understand NETBIOS name types

Terms and Utilities:

◈ smb.conf
◈ nmblookup
◈ smbclient
◈ name resolve order
◈ lmhosts
◈ wins support, wins server, wins proxy, dns proxy
◈ domain master, os level, preferred master

396.2 Active Directory Name Resolution

Weight: 2

Description: Candidates should be familiar with the internal DNS server with Samba4.

Key Knowledge Areas:

◈ Understand and manage DNS for Samba4 as an AD Domain Controller
◈ DNS forwarding with the internal DNS server of Samba4

Terms and Utilities:

◈ samba-tool dns (with subcommands)
◈ smb.conf
◈ dns forwarder
◈ /etc/resolv.conf
◈ dig, host

Topic 397: Working with Linux and Windows Clients


397.1 CIFS Integration

Weight: 3

Description: Candidates should be comfortable working with CIFS in a mixed environment.

Key Knowledge Areas:

◈ Understand SMB/CIFS concepts
◈ Access and mount remote CIFS shares from a Linux client
◈ Securely storing CIFS credentials
◈ Understand features and benefits of CIFS
◈ Understand permissions and file ownership of remote CIFS shares

Terms and Utilities:

◈ SMB/CIFS
◈ mount, mount.cifs
◈ smbclient
◈ smbget
◈ smbtar
◈ smbtree
◈ findsmb
◈ smb.conf
◈ smbcquotas
◈ /etc/fstab

397.2 Working with Windows Clients

Weight: 2

Description: Candidates should be able to interact with remote Windows clients, and configure Windows workstations to access file and print services from Linux servers.

Key Knowledge Areas:

◈ Knowledge of Windows clients
◈ Explore browse lists and SMB clients from Windows
◈ Share file / print resources from Windows
◈ Use of the smbclient program
◈ Use of the Windows net utility

Terms and Utilities:

◈ Windows net command
◈ smbclient
◈ control panel
◈ rdesktop
◈ workgroup

Wednesday, 9 May 2018

Translate/ tr Command Examples in Unix and Linux

Translate/ tr Command, Unix Command, Linux Command

Tr stands for translate or transliterate. The tr utility in unix or linux system is used to translate, delete or squeeze characters. The syntax of tr command is

tr [options] set1 [set2]

The options of tr command are:
◒ -c : complements the set of characters in string.
◒ -d : deletes the characters in set1
◒ -s : replaces repeated characters listed in the set1 with single occurrence
◒ -t : truncates set1

Tr command Examples:

1. Convert lower case letters to upper case


The following tr command translates the lower case letters to capital letters in the give string:

> echo "linux dedicated server" | tr "[:lower:]" "[:upper:]"
LINUX DEDICATED SERVER
> echo "linux dedicated server" | tr "[a-z]" "[A-Z]"
LINUX DEDICATED SERVER

2. Transform upper case letters to lower case.


Similar to the above example, you can translate the uppercase letters to small letters.

> echo "UNIX DEDICATED SERVER" | tr "[:upper:]" "[:lower:]"
unix dedicated server
> echo "UNIX DEDICATED SERVER" | tr "[A-Z]" "[a-z]"
unix dedicated server

3. Replace non-matching characters.


The -c option is used to replace the non-matching characters with another set of characters.

> echo "unix" | tr -c "u" "a"
uaaa

Translate/ tr Command, Unix Command, Linux Command

In the above example, except the character "u" other characters are replaced with "a"

4. Delete non-printable characters


The -d option can be used to delete characters. The following example deletes all the non-printable characters from a file.

> tr -cd "[:print:]" < filename


5. Squeezing characters


You can squeeze more than one occurrence of continuous characters with single occurrence. The following example squeezes two or more successive blank spaces into a single space.

> echo "linux    server" | tr -s " "
linux server

Here you can replace the space character with any other character by specifying in set2.

> "linux    server" | tr -s " " ","
linux,server

6. Delete characters


The following example removes the word linux from the string.

> echo "linuxserver" | tr -d "linux"
server