Sunday, August 7, 2016

Flexible Single Master Operator (FSMOwi)


  • FSMO


Acronym for Flexible Single Master Operator. These are roles that are assigned only to designated domain controllers, either one in each domain, or one in the forest. The five FSMO roles are:

    Schema Master (one for the forest)
    Domain Naming Master (one for the forest)
    PDC Emulator (one for each domain)
    RID Master (one for each domain)
    Infrastructure Master (one for each domain)

Schema Master
The Schema Master role holder is the domain controller that can make changes to the Schema. One domain controller in the forest must hold this role. One of the five Flexible Single Master Operator roles (FSMO).

 
Infrastructure Master
The Infrastructure Master role holder is the domain controller that maintains references, called phantoms, to objects in other domains. One domain controller in each domain must hold this role. One of the five Flexible Single Master Operator (FSMO) roles.

RID Master
The RID Master role holder is the domain controller responsible for assigning pools of RID's to all domain controllers in the domain. A RID is required whenever a security principal is created in Active Directory. One domain controller in each domain must hold this role. One of the five Flexible Single Master Operator roles (FSMO).
Security Principal
An object in Active Directory to which security can be applied. A security principal must have the objectSID attribute, so it can be the trustee in an Access Control Entry (ACE).
RID
Acronym for Relative IDentifier. All security principals (users, computers, and groups) in Active Directory have a Security ID (SID). SID values include several components, including the RID. The SID without the RID is the same for all objects in a domain. The RID value uniquely identifies the object in the domain

PDC Emulator
The PDC Emulator role holder acts as the Windows NT Primary Domain Controller (PDC) for backward compatibility. It also is used to forward password changes immediately to other domain controllers and serves as the primary time source for the domain. The PDC Emulator is also targeted by most Group Policy tools. One domain controller in each domain must hold this role. One of the five Flexible Single Master Operator roles (FSMO).

Domain Naming Master
The Domain Naming Master role holder is the domain controller that controls changes to the forest-wide namespace. One of the five Flexible Single Master Operator (FSMO) roles. The domain controller with this role can add, remove, rename, or move domains in the forest. It is also required to create application partitions. One domain controller in the forest must hold this role.
http://social.technet.microsoft.com/wiki/contents/articles/16757.active-directory-glossary.aspx#FSMO



  • How to find out who has your FSMO Roles?


1-The easy way:
NetDOM /query FSMO

2-The Common way:
How to Determine the RID, PDC, and Infrastructure FSMO Holders of a Selected Domain
1. Click Start, click Run, type dsa.msc, and then click OK.
2. Right-click the selected Domain Object in the top left pane, and then click Operations Masters.
3. Click the PDC tab to view the server holding the PDC master role.
4. Click the Infrastructure tab to view the server holding the Infrastructure master role.
5. Click the RID Pool tab to view the server holding the RID master role.

How to Determine the Schema FSMO Holder in a Forest
1. Click Start, click Run, type mmc, and then click OK.
2. On the Console menu, click Add/Remove Snap-in, click Add, double-click Active Directory Schema, click Close, and then click OK.
3. Right-click Active Directory Schema in the top left pane, and then click Operations Masters to view the server holding the schema master role.
NOTE: For the Active Directory Schema snap-in to be available, you may have to register the Schmmgmt.dll file. To do this, click Start, click Run, type regsvr32 schmmgmt.dll in the Open box, and then click OK. A message is displayed that states the registration was successful.

How to Determine the Domain Naming FSMO Holder in a Forest
1. Click Start, click Run, type mmc, and then click OK.
2. On the Console menu, click Add/Remove Snap-in, click Add, double-click Active Directory Domains and Trusts, click Close, and then click OK.
3. In the left pane, click Active Directory Domains and Trusts.
4. Right-click Active Directory Domains and Trust, and then click Operations Master to view the server holding the domain naming master role in the Forest.


https://blogs.technet.microsoft.com/mempson/2007/11/08/how-to-find-out-who-has-your-fsmo-roles



  • How To Find Servers That Hold Flexible Single Master Operations Roles

    How to Determine the RID, PDC, and Infrastructure FSMO Holders of a Selected Domain
    How to Determine the Schema FSMO Holder in a Forest
    How to Determine the Domain Naming FSMO Holder in a Forest
    Using the Windows 2000 Server Resource Kit
    Using the NTDSUTIL Tool
    Using DCDIAG
https://support.microsoft.com/en-us/kb/234790



  • the domain controller that actually performs a single master operation is the

domain controller that currently holds the operation’s token, or the “role holder.”
An operation token, and thus the role, can be transferred easily to another domain
controller without a reboot.

AD DS contains five operations master roles. Two roles are performed for the
entire forest, and two roles are performed by three roles for each domain.
Forest Roles (two roles):

    Domain naming
    Schema

Domain Roles (three roles):

    Relative identifier (RID)
    Infrastructure
    PDC Emulator


RID Master Role
Because any domain controller can create
accounts, and therefore, SIDs, a mechanism is necessary to ensure that the SIDs
generated by a DC are unique. Active Directory domain controllers generate SIDs
by assigning a unique RID to the domain SID. The RID master for the domain
allocates pools of unique RIDs to each domain controller in the domain. Thus,
each domain controller can be confident that the SIDs it generates are unique.
Note:

The RID master role is like DHCP for SIDs. If you are familiar with the concept that
you allocate a scope of IP addresses for the Dynamic Host Configuration Protocol (DHCP) server to assign to clients, you can draw a parallel to the RID master, which allocates pools of RIDs to domain controllers for the creation of SIDs

Infrastructure Master Role
In a multidomain environment, it’s common for an object to reference objects in other domains. For example, a group can include members from another domain
You can think of the infrastructure master as a tracking device for group members from other domains. When those members are renamed or moved in the other domain, the infrastructure master identifies the change and makes appropriate changes to group memberships so that the memberships are kept up to date.

This role only pertains in a multi-domain forest. The infrastructure master if running on the same DC as a GC, will conflict and cause the infrastructure master role to fail its intended purpose


PDC Emulator Role
 Emulates a Primary Domain Controller (PDC) for backward compatibility

 Participates in special password update handling for the domain
  If a user attempts to log on immediately after
changing passwords, the domain controller responding to the user’s logon
request might not know about the new password. Before it rejects the logon
attempt, that domain controller forwards the authentication request to a PDC
emulator, which verifies that the new password is correct and instructs the
domain controller to accept the logon request

 Manages Group Policy updates within a domain
  When you open a GPO in
the Group Policy Management Editor (GPME), the GPME binds to the domain
controller performing the PDC emulator role. Therefore, all changes to GPOs
are made on the PDC emulator by default.

Provides a master time source for the domain
Active Directory, Kerberos, File Replication Service (FRS), and DFS-R each rely
on timestamps, so synchronizing the time across all systems in a domain is
crucial. The PDC emulator in the forest root domain is the time master for the
entire forest, by default. The PDC emulator in each domain synchronizes its
time with the forest root PDC emulator. Other domain controllers in the
domain synchronize their clocks against that domain’s PDC emulator. All
other domain members synchronize their time with their preferred domain
controller. This hierarchical structure of time synchronization, all implemented
through the Win32Time service, ensures consistency of time. Universal
Coordinated Time (UTC) is synchronized, and the time displayed to users is
adjusted based on the time zone setting of the computer.
 
http://blogs.msmvps.com/acefekay/2011/01/16/active-directory-fsmo-roles-explained



  • Depending on the FSMO role that you want to transfer, you can use one of the following three MMC snap-in tools:

Active Directory Schema snap-in
Active Directory Domains and Trusts snap-in
Active Directory Users and Computers snap-in
https://support.microsoft.com/en-us/kb/324801

Active Directory Migration from Windows Server 2008 R2 to Windows Server 2012 R2


  • Step-By-Step: Active Directory Migration from Windows Server 2008 R2 to Windows Server 2012 R2


With the end of support for Windows Server 2003
As mentioned, Windows Server 2012 R2 provides a great first step towards cloud adoption. In addition to this the ability to allow your organization to take advantage of capabilities such as Active Directory Recycle Bin improvements, DHCP failover, Dynamic Access Control, Hyper-V replication and much more.
Migrating Active Directory off your existing Windows 2008 R2 server and onto a new Windows 2012 R2


Prerequisites
    Download Windows Server 2012 R2. You also have the ability to complete this Step-By-Step in a virtual lab by downloading Hyper-V Server 2012 for free.
    As a precaution, complete a full backup of your existing server.
    Check the Schema version of AD DS (Before adprep) by running regedit, navigating to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NTDS\Parameters and noting the current Schema version.

Step 1: Preparing your existing forest via the adprep command
    Insert the Windows Server 2012 DVD into the DVD drive of the Windows Server 2008 R2 AD DS.
    Open command prompt, and type adprep /forestprep and press enter.
    Check the Schema version of AD DS (After adprep) by running regedit, navigating to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NTDS\Parameters and noting the current Schema version.
 
Step 2: Promoting the Windows Server 2012 Server domain controller

Step 3: Verify the new Windows Server 2012 Domain Controller
    Open Active Directory Users and Computers, expand <Your Domain> and click the Domain Controller OU to verify your server is listed.  
    Open DNS Manager, right-click on <Your Domain>, select Properties and then click Name Servers Tab. Verify that your server is listed in Name Servers: lists.  
    Open Active Directory Sites and Services; verify that your server is listed in Servers under Default-First-Site-Name.

Step 4: Transferring the Flexible Single Master Operations (FSMO) Role
    Open the Active Directory Users and Computers console on your new Windows Server 2012 computer.  
    Right click your domain and select Operations Masters in the sub menu.  
    In the Operations Masters window, ensure the RID tab is selected.  
    Select the Change button.
    Select Yes when asked about transferring the operations master role.
Once the operations master role has successfully transferred, click OK to continue.
Ensure the Operations Master box now shows your new 2012 Windows Server.
Repeat steps 4 to 6 for the PDC and Infrastructure tabs.
Once completed, click Close to close the Operations Masters window.
Close the Active Directory Users and Computers window.  

Step 5: Removing the Windows 2008 R2 domain controller
    On the Windows 2008 R2 server click Start, Click Run, type dcpromo, then click OK.  
    After the Welcome to the Active Directory Installation Wizard page, be sure to leave the Delete the domain because this server is the last domain controller in the domain unchecked.  
    On the Administrator Password Page, enter your password and click Next.  
    On the Summary page, click Next, wait for the process to end, then click Finish.  
    On the Completing the Active Directory Domain Services Installation Wizard, click Finish.  
    On the Active Directory Domain Services Installation Wizard page, click Restart Now to Restart the server.  
    After the reboot is completed, delete the Windows Server 2008 R2 server from the domain to a workgroup and remove any unnecessary record from Active Directory Sites and Services.


https://blogs.technet.microsoft.com/canitpro/2014/05/27/step-by-step-active-directory-migration-from-windows-server-2008-r2-to-windows-server-2012-r2/


Verify the schema version
Note - You can verify the schema version using dsquery * cn=schema,cn=configuration,dc=sivarajan,dc=com -scope base -attr objectVersion command. The following table lists the Active Directory Schema and the corresponding Object Version:

Active Directory Object Version
Windows 2000 13
Windows 2003 30
Windows 2003 R2 31
Windows 2008 44
Windows 2008 R2 47
Windows 8 Beta 52
Windows 2012 56
Windows 2012 R2 69

Check the Schema version of AD DS (After adprep) by running regedit, navigating to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NTDS\Parameters and noting the current Schema version.




  • View Active Directory schema version


1-You can use registry too:
HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Parame ters\SchemaVersion

2-the objectVersion in ADSIEdit.

3-"dsquery * cn=schema,cn=configuration,dc=domainname,dc=local -scope base -attr objectVersion"

https://social.technet.microsoft.com/Forums/windowsserver/en-US/45f8e9b9-07b9-4af7-9eba-d87169dccc22/view-active-directory-schema-version?forum=winserverDS



  • Active Directory: Active Directory Upgrade - High Level Steps


Upgrade schema
Upgrade the schema using correct version of OS – Adprep

Verify the schema version

Add additional DC
New server
Install a new server with correct version of OS and join this server to the existing domain

Promote DC
Perform DCPRMO on this server and select Additional Domain Controller for an existing Domain option.

Transfer Roles
If you are planning to decommission the old servers, you need transfer FSMO roles, DHCP etc to the new server.
You can identify the FSMO role DC information using Netdom /Query FSMO command.

Decommission old DC
You can remove (demote) a domain controller using DCPROMO command and again
http://social.technet.microsoft.com/wiki/contents/articles/2903.active-directory-active-directory-upgrade-high-level-steps.aspx

Active Directory Migration from Windows Server 2008 R2 to Windows Server 2012 R2


  • Step-By-Step: Active Directory Migration from Windows Server 2008 R2 to Windows Server 2012 R2


With the end of support for Windows Server 2003
As mentioned, Windows Server 2012 R2 provides a great first step towards cloud adoption. In addition to this the ability to allow your organization to take advantage of capabilities such as Active Directory Recycle Bin improvements, DHCP failover, Dynamic Access Control, Hyper-V replication and much more.
Migrating Active Directory off your existing Windows 2008 R2 server and onto a new Windows 2012 R2


Prerequisites
    Download Windows Server 2012 R2. You also have the ability to complete this Step-By-Step in a virtual lab by downloading Hyper-V Server 2012 for free.
    As a precaution, complete a full backup of your existing server.
    Check the Schema version of AD DS (Before adprep) by running regedit, navigating to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NTDS\Parameters and noting the current Schema version.

Step 1: Preparing your existing forest via the adprep command
    Insert the Windows Server 2012 DVD into the DVD drive of the Windows Server 2008 R2 AD DS.
    Open command prompt, and type adprep /forestprep and press enter.
    Check the Schema version of AD DS (After adprep) by running regedit, navigating to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NTDS\Parameters and noting the current Schema version.
 
Step 2: Promoting the Windows Server 2012 Server domain controller

Step 3: Verify the new Windows Server 2012 Domain Controller
    Open Active Directory Users and Computers, expand <Your Domain> and click the Domain Controller OU to verify your server is listed.  
    Open DNS Manager, right-click on <Your Domain>, select Properties and then click Name Servers Tab. Verify that your server is listed in Name Servers: lists.  
    Open Active Directory Sites and Services; verify that your server is listed in Servers under Default-First-Site-Name.

Step 4: Transferring the Flexible Single Master Operations (FSMO) Role
    Open the Active Directory Users and Computers console on your new Windows Server 2012 computer.  
    Right click your domain and select Operations Masters in the sub menu.  
    In the Operations Masters window, ensure the RID tab is selected.  
    Select the Change button.
    Select Yes when asked about transferring the operations master role.
Once the operations master role has successfully transferred, click OK to continue.
Ensure the Operations Master box now shows your new 2012 Windows Server.
Repeat steps 4 to 6 for the PDC and Infrastructure tabs.
Once completed, click Close to close the Operations Masters window.
Close the Active Directory Users and Computers window.  

Step 5: Removing the Windows 2008 R2 domain controller
    On the Windows 2008 R2 server click Start, Click Run, type dcpromo, then click OK.  
    After the Welcome to the Active Directory Installation Wizard page, be sure to leave the Delete the domain because this server is the last domain controller in the domain unchecked.  
    On the Administrator Password Page, enter your password and click Next.  
    On the Summary page, click Next, wait for the process to end, then click Finish.  
    On the Completing the Active Directory Domain Services Installation Wizard, click Finish.  
    On the Active Directory Domain Services Installation Wizard page, click Restart Now to Restart the server.  
    After the reboot is completed, delete the Windows Server 2008 R2 server from the domain to a workgroup and remove any unnecessary record from Active Directory Sites and Services.


https://blogs.technet.microsoft.com/canitpro/2014/05/27/step-by-step-active-directory-migration-from-windows-server-2008-r2-to-windows-server-2012-r2/


Verify the schema version
Note - You can verify the schema version using dsquery * cn=schema,cn=configuration,dc=sivarajan,dc=com -scope base -attr objectVersion command. The following table lists the Active Directory Schema and the corresponding Object Version:

Active Directory Object Version
Windows 2000 13
Windows 2003 30
Windows 2003 R2 31
Windows 2008 44
Windows 2008 R2 47
Windows 8 Beta 52
Windows 2012 56
Windows 2012 R2 69

Check the Schema version of AD DS (After adprep) by running regedit, navigating to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\NTDS\Parameters and noting the current Schema version.




  • View Active Directory schema version


1-You can use registry too:
HKLM\SYSTEM\CurrentControlSet\Services\NTDS\Parame ters\SchemaVersion

2-the objectVersion in ADSIEdit.

3-"dsquery * cn=schema,cn=configuration,dc=domainname,dc=local -scope base -attr objectVersion"

https://social.technet.microsoft.com/Forums/windowsserver/en-US/45f8e9b9-07b9-4af7-9eba-d87169dccc22/view-active-directory-schema-version?forum=winserverDS



  • Active Directory: Active Directory Upgrade - High Level Steps


Upgrade schema
Upgrade the schema using correct version of OS – Adprep

Verify the schema version

Add additional DC
New server
Install a new server with correct version of OS and join this server to the existing domain

Promote DC
Perform DCPRMO on this server and select Additional Domain Controller for an existing Domain option.

Transfer Roles
If you are planning to decommission the old servers, you need transfer FSMO roles, DHCP etc to the new server.
You can identify the FSMO role DC information using Netdom /Query FSMO command.

Decommission old DC
You can remove (demote) a domain controller using DCPROMO command and again
http://social.technet.microsoft.com/wiki/contents/articles/2903.active-directory-active-directory-upgrade-high-level-steps.aspx

Read-only domain controllers (RODCs)


  • What Is an RODC?

Applies To: Windows Server 2008, Windows Server 2012

Read-only domain controllers (RODCs) are a new feature of Active Directory Domain Services (AD DS) in Windows Server 2008. RODCs are additional domain controllers for a domain that host complete, read-only copies of the partitions of the Active Directory database and a read-only copy of the SYSVOL folder contents. By selectively caching credentials, RODCs address some of the challenges that enterprises can encounter in branch offices and perimeter networks (also known as DMZs) that may lack the physical security that is commonly found in datacenters and hub sites. RODCs also offer a number of manageability improvements
https://technet.microsoft.com/en-us/library/cc771030(v=ws.10).aspx


  • Advantages That an RODC Can Provide to an Existing Deployment

Security
Unidirectional replication. Unidirectional replication refers to how RODCs can replicate changes inbound but outbound replication does not occur.
Special krbtgt account. Each RODC has a special krbtgt account that also helps to restrict malicious updates from affecting the rest of the forest
Password Replication Policy (PRP). Each RODC has a PRP that, by default, does not allow any passwords to be cached on the RODC
RODC filtered attribute set (FAS). You can also restrict which application data can replicate to RODCs in your forest by adding attributes to the RODC FAS and marking them as confidential.
https://technet.microsoft.com/en-us/library/cc770320(v=ws.10).aspx

Adprep


  • Adprep

Applies To: Windows Server 2003, Windows Server 2008, Windows Server 2003 R2, Windows Server 2012, Windows Server 2003 with SP1, Windows 8

Extends the Active Directory® schema and updates permissions as necessary to prepare a forest and domain for a domain controller that runs the Windows Server® 2008 operating system.

Adprep.exe is a command-line tool that is available on the Windows Server 2008 installation disc in the \sources\adprep folder, and it is available on the Windows Server 2008 R2 installation disk in the \support\adprep folder. You must run adprep from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

In Windows Server 2008 R2, Adprep is available in a 32-bit version and a 64-bit version. The 64-bit version runs by default

https://technet.microsoft.com/en-us/library/cc731728(v=ws.11).aspx

Prepare your Domain for the Windows Server 2008 R2 Domain Controller

Prepare your Domain for the Windows Server 2008 R2 Domain Controller

Before installing the first Windows Server 2008 R2 domain controller (DC) into an existing Windows 2000, Windows Server 2003 or Windows Server 2008 domain, you must prepare the AD forest and domain. You do so by running a tool called ADPREP.

What does ADPREP do? ADPREP has parameters that perform a variety of operations that help prepare an existing Active Directory environment for a domain controller that runs Windows Server 2008 R2. Not all versions of ADPREP perform the same operations, but generally the different types of operations that ADPREP can perform include the following:

    Updating the Active Directory schema
    Updating security descriptors
    Modifying access control lists (ACLs) on Active Directory objects and on files in the SYSVOL shared folder
    Creating new objects, as needed
    Creating new containers, as needed
   
    To prepare the forest and domain for the installation of the first Windows Server 2008 R2 domain controller
    The following tasks are required ONLY before adding the first Windows Server 2008 R2 domain controller
   
    you cannot join a Windows Server 2008 R2 server to a Windows NT 4.0 domain
  If any domain controllers in the forest are running Windows 2000 Server, they must be running Service Pack 4 (SP4).
 
  You should test the ADPREP schema updates in a lab environment to ensure that they will not conflict with any applications that run in your environment.
  You must make a system state backup for your domain controllers, including the schema master and at least one other domain controller from each domain in the forest
  make sure that you can log on to the schema master with an account that has sufficient credentials to run adprep /forestprep.
  You must be a member of the Schema Admins group, the Enterprise Admins group, and the Domain Admins group of the domain that hosts the schema master, which is, by default, the forest root domain.
 
  Browse to the X:\support\adprep folder, where X: is the drive letter of your DVD drive. Find a file called adprep.exe or adprep32.exe.
  Windows Server 2008 R2 ADPREP is available in a 32-bit version and a 64-bit version
 
  In the Command Prompt window, type the following command:
    adprep /forestprep
 
  ADPREP will take several minutes to complete. During that time, several LDF files will be imported into the AD Schema, and messages will be displayed in the Command Prompt window. File sch47.ldf seems to be the largest one.
  ADPREP should only be run on an existing DC.
  Allow the operation to complete, and then allow the changes to replicate throughout the forest
 
  In the Command Prompt window, type the following command
  adprep /domainprep
 
  If you’re running a Windows 2008 Active Directory domain, that’s it, no additional tasks are needed.
 If you’re running a Windows 2000 Active Directory domain, you must also the following command:
    adprep /domainprep /gpprep
    If you’re running a Windows 2003 Active Directory domain, that’s it, no additional tasks are needed. However, if you’re planing to run Read Only Domain controllers (RODCs), you must also type the following command:
    adprep /rodcprep
 

To verify that adprep /forestprep completed successfully please perform these steps:

1. Log on to an administrative workstation that has ADSIEdit installed. ADSIEdit is installed by default on domain controllers that run Windows Server 2008 or Windows Server 2008 R2. On Windows Server 2003 you must install the Resource Kit Tools.

2. Click Start, click Run, type ADSIEdit.msc, and then click OK.

3. Click Action, and then click Connect to.

4. Click Select a well known Naming Context, select Configuration in the list of available naming contexts, and then click OK.

5. Double-click Configuration, and then double-click CN=Configuration,DC=forest_root_domain where forest_root_domain is the distinguished name of your forest root domain.

6. Double-click CN=ForestUpdates.

7. Right-click CN=ActiveDirectoryUpdate, and then click Properties.

8. If you ran adprep /forestprep for Windows Server 2008 R2, confirm that the Revision attribute value is 5, and then click OK.

9. Click ADSI Edit, click Action, and then click Connect to.

10. Click Select a Well known naming context, select Schema in the list of available naming contexts, and then click OK.

11. Double-click Schema.

12. Right-click CN=Schema,CN=Configuration,DC=forest_root_domain, and then click Properties.

13. If you ran adprep /forestprep for Windows Server 2008 R2, confirm that the objectVersion attribute value is set to 47, and then click OK.  
https://www.petri.com/prepare-for-server-2008-r2-domain-controller

Sunday, July 10, 2016

unix interview questions


  • The following command displays output only on the screen (stdout).

$ ls
The following command writes the output only to the file and not to the screen.
$ ls > file
The following command (with the help of tee command) writes the output both to the screen (stdout) and to the file.
$ ls | tee file
http://linux.101hacks.com/unix/tee-command-examples


  • Syntax To redirect all error to file

command-name 2> errors.txt

syntax to redirect both output (stdout) and errors (stderr) to same file
command1 > everything.txt 2>&1

Syntax to redirect errors (stderr) to null or zero devices
Data written to a null or zero special file is discarded by your system. This is useful to silence out errors (also know as ‘error spam’):
command1 2> /dev/null
command1 2> /dev/zero

http://www.cyberciti.biz/faq/linux-redirect-error-output-to-file/


  • /dev/null

On Unix/Linux system there is a special
file called /dev/null. It behaves like a black hole. Whatever is printed to that file will disappear without any trace. The main use of this is when there is a program and the user wants to throw away either the regular output or the error messages.
For example, you might have an application, one that you cannot change, that spit tons of messages to the standard error channel. If you don't want to see that on the screen you can redirect it to a file. But if you do that, it can fill your disk quickly. So instead, you would redirect the standard error to /dev/null and the operating system will help you disregard all the "garbage".
http://perlmaven.com/stdout-stderr-and-redirection


  • Every process in Linux is provided with three open filesusually called file descriptor). These files are the standard input, output and error files. By default :


    Standard Input is the keyboard, abstracted as a file to make it easier to write shell scripts.
    Standard Output is the shell window or the terminal from which the script runs, abstracted as a file to again make writing scripts & program easier
    Standard error is the same as standard output:the shell window or terminal from which the script runs.

A file descriptor is simply a number that refers to an open file. By default , file descriptor 0 (zero) refers to the standard input & often abbreviated as stdin. File descriptor 1 refers to standard output (stdout) and file descriptor 2 refers to standard error (stderr)
http://www.linuxtechi.com/standard-input-output-error-in-linux


  • BASH Shell: How To Redirect stderr To stdout redirect stderr to a File )

Bash and other modern shell provides I/O redirection facility. There are 3 default standard files (standard streams) open:
[a] stdin – Use to get input (keyboard) i.e. data going into a program.
[b] stdout – Use to write information (screen)
[c] stderr – Use to write error message (screen)

Understanding I/O streams numbers
The Unix / Linux standard I/O streams with numbers:

Handle Name Description
0 stdin Standard input
1 stdout Standard output
2 stderr Standard error

The following will redirect program error message to a file called error.log:
$ program-name 2> error.log

http://www.cyberciti.biz/faq/redirecting-stderr-to-stdout


  • 25 Linux Shell Scripting interview Questions & Answers


What is Shell Script and why it is required ?
Ans: A Shell Script is a text file that contains one or more commands. As a system administrator we often need to issue number of commands to accomplish the task, we can add these all commands together in a text file (Shell Script) to complete daily routine task.

Q:2 What is the default login shell and how to change default login shell for a specific user ?
# chsh <username> -s <new_default_shell>
# chsh linuxtechi -s /bin/sh

Q:4 How to redirect both standard output and standard error to the same location ?
Ans: There two method to redirect std output and std error to the same location:
Method:1 2>&1 (# ls /usr/share/doc > out.txt 2>&1 )
Method:2 &> (# ls /usr/share/doc &> out.txt )

http://www.linuxtechi.com/linux-shell-scripting-interview-questions-answers/


  •  What is the system command to find the current environment variables of the shell you’re running?

 The command is “env”. The output will depend on which system you’re running:

 What is swapping and paging?
 Consider a reference book, for example. You only open the page you need- you don’t need to have all the pages open at once. That is both almost impossible and extremely inefficient. A book is comparable to a process in UNIX. At any given time, there are several books that UNIX is reading. However, UNIX only takes a few pages from a book at one time, as needed. Once it is done with the page, or if it becomes “old”, it is sent back to storage. This is known as paging. Sometimes UNIX sends the entire book, with all its pages, back to the memory- this is known as swapping. This happens when the work load is really heavy.

Paging is more efficient if UNIX is running a large number of processes at one time. Pages (memory segments) can be stored and retrieved as needed. Swapping is more demanding in terms of resources and memory, but it provides faster results, as UNIX doesn’t need to search and retrieve pages every single time while it is executing a process
 https://blog.udemy.com/unix-shell-scripting-interview-questions/

Specify the difference between absolute path and related path?
Absolute path refers to the exact path as defined from the root directory. Related path refers to the path related to the current locations.

What is the FIFO?
FIFO (First In First Out) is also called named pipes and it is a special file for date transient. Data is read-only in the written order. This is used to inter-process communications, where data write to one end and reads from another end of the pipe.

What is mean by Super User?
The user with access to all files and commands within the system is called a superuser. Generally, the superuser login is to root and the login is secured with the root password.

What is the process group?
A collection of one or more processes is called process group. There is a unique process id for each process group. The function “getpgrp” returns the process group ID for the calling process.

What are the different file types available with UNIX?
    Regular files
    Directory files
    Character special files
    Block special files
    FIFO
    Symbolic links
    Socket
   
https://www.softwaretestinghelp.com/unix-interview-questions/


  • The mkfifo command basically lets you create FIFOs (a.k.a named pipes)

You'd have seen commands that contain a vertical bar (|) in them. This bar is called a pipe. What it does is, it creates a channel of communication between the two processes (when the complete command is executed).

ls | grep .txt
The command mentioned above consists of two programs: ls and grep.
Both these programs are separated by a pipe (|)
So what pipe does here is, it creates a channel of communication between these programs
when the aforementioned command is executed, the output of ls is fed as input to grep.
So finally, the output that gets displayed on the terminal consists of only those entries that have '.txt' string in them.

mkfifo pipe2

So 'pipe2' is now a named pipe. Now comes the question how named pipes are more useful? Well, consider the case where you have a process running in a terminal and producing output, and what you want is to channelize that output on to a different terminal. So here, a named pipe could of great help.


https://www.howtoforge.com/linux-mkfifo-command/



  • Some of the frequently used shells in UNIX include the following:

    tcsh – enhanced C Shell
    zsh – Z SHell
    sh – Bourne shell
    csh – C SHell
    ksh – Korn SHell
    bash – Bourne Again Shell

Nohup is a distinctive command that is utilized to run the process in the background, yet it is marginally unique in relation to and which is typically utilized for putting a procedure in the background. A typical UNIX process that began with nohup will not stop regardless of whether the client has logged off from the framework. While the background process began with and will stop when the client logoff

https://www.onlineinterviewquestions.com/unix-interview-questions/   



  • Explain the difference between soft and hard links?

The most common difference between the soft and hard link is, a hard link is a direct reference to the file in UNIX. However, on the other hand, the soft link is the name refers to the file which means they point out files using their names.

Can you link directories to soft links?
Yes, you can link directories to the soft links as the file system structure supports them.

How do you know if you have the soft or hard link?
The soft link commonly known as the symbolic is the original copy of the file while the hard link is the perfect replica of the original file. So, if you delete the original copy from the system then the soft link won’t have any value but the case is right opposite in hard link.

How hard links are used in the UNIX?
What hard links do on an immediate basis is to break down the file system structure to process the information. Unlike soft links, hard links cannot be spanned across the file system.

Do hard and soft link shares the same Inode?
Yes, both hard link and soft link share the same inode.

Do hard link work even after deleting the soft link?
Yes, the hard will work even after you end up deleting the soft file. As they are a perfect mirror copy of soft link, you can access the file until the links to the file are do not end up on zero.

Can you link directories to hard links?
directories don’t fit into the system and essentially break it. So, in order to protect the file system structure, directories are avoided link with hard links.
https://www.gangboard.com/blog/unix-shell-scripting-interview-questions-and-answers/


  • Discuss the difference between swapping and paging?


Swapping – The complete process is moved to the main memory for execution. To provide the memory requirement, the process size must be less than the available main memory capacity. The implementation is easy but is an overhead to the system. Memory handling is not more flexible with swapping systems.
It the procedure of copying the entire process from main memory onto secondary memory.
For execution, the whole process is moved from swap device to the main memory.

Paging – Only the required memory pages are moved to the main memory for execution.

What do understand by Kernel?
Unix operating system is basically divided into three parts, namely, the kernel, the shell, and the commands and utilities

Explain Superblock in UNIX?
Each logical partitions in Unix are referred to as the File system and each file system contains, a ‘boot block’, a ‘superblock’, ‘inodes’, and data blocks’.
https://www.softwaretestinghelp.com/unix-interview-questions/

Tuesday, July 5, 2016

VM Player vs VMware Workstation


  • Workstation has some features that Player lacks, such as teams (groups of VMs connected by private LAN segments) and multi-level snapshot trees. It's aimed at power users and developers; they even have some hooks for using a debugger on the host to debug code in the VM (including kernel-level stuff). The core technology is the same, though.


VMware Workstation is much more advanced and comes with powerful features including snapshots, cloning, remote connections to vSphere, sharing VMs, advanced Virtual Machines settings and much more. Workstation is designed to be used by technical professionals such as developers, quality assurance engineers, systems engineers, IT administrators, technical support representatives, trainers, etc
https://stackoverflow.com/questions/4170600/vmware-player-vs-vmware-workstation


  • VMware Player enables you to quickly and easily create and run virtual machines. However, VMware Player lacks many powerful features, remote connections to vSphere, drag and drop upload to vSphere, multiple Snapshots and Clones, and much more.

https://www.vmware.com/products/player/faqs.html

Thursday, June 30, 2016

quantum computer


  • Quantum computing is computing using quantum-mechanical phenomena, such as superposition and entanglement

A quantum computer is a device that performs quantum computing.
Such a computer is completely different from binary digital electronic computers based on transistors and capacitors.
common digital computing requires that the data be encoded into binary digits (bits), each of which is always in one of two definite states (0 or 1),
quantum computation uses quantum bits or qubits, which can be in superpositions of states.

https://en.wikipedia.org/wiki/Quantum_computing
  • What is a quantum computer?

A quantum computer is a device able to manipulate delicate quantum states in a controlled fashion, not dissimilar from the way an ordinary computer manipulates its bits.

What does a quantum computer look like?
A quantum computer looks like nothing you have on your desk, or in your office, or in your pocket. It is housed in a large unit known as a dilution refrigerator and is supported by multiple racks of electronic pulse-generating equipment. However, you can access our quantum computer with very familiar personal computing devices, such as laptops, tablets, and smartphones.

What is a qubit?
A qubit (pronounced “cue-bit” and short for quantum bit) is the physical carrier of quantum information. It is the quantum version of a bit and its quantum state can take values of 0, 1, or both at once, which is a phenomenon known as superposition.

What is a superposition?
A superposition is a weighted sum or difference of two or more states; for example, the state of the air when two or more musical tones are sounding at once. Ordinary, or “classical,” superpositions commonly occur in macroscopic phenomena involving waves.

How is superposition different from probability?
A set of n coins, each of which might be heads or tails, can be described as a probabilistic mixture of states, but it actually is in only one of them—we just don’t know which. For this reason quantum superposition is more powerful than classical probabilism. Quantum computers capable of holding their data in superposition can solve some problems exponentially faster than any known deterministic or probabilistic classical algorithm. A more technical difference is that while probabilities must be positive (or zero), the weights in a superposition can be positive, negative, or even complex numbers.


http://www.research.ibm.com/quantum/


  • Today, real quantum computers can be accessed through the cloud, and many thousands of people have used them to learn, conduct research, and tackle new problems.

Quantum computers could one day provide breakthroughs in many disciplines, including materials and drug discovery, the optimization of complex systems, and artificial intelligence.

Quantum and Chemistry
For challenges above a certain size and complexity, we don’t have enough computational power on Earth to tackle them. To stand a chance at solving some of these complex problems, we need a new kind of computing: one whose computational power also scales exponentially as the system size grows.

What makes it ‘quantum’?
All computing systems rely on a fundamental ability to store and manipulate information. Current computers manipulate individual bits, which store information as binary 0 and 1 states.
Millions of bits work together to process and display information.
Quantum computers leverage different physical phenomena
superposition
entanglement
interference
to manipulate information.
To do this, we rely on different physical devices: quantum bits, or qubits

Superposition refers to a combination of states we would ordinarily describe independently. To make a classical analogy, if you play two musical notes at once, what you will hear is a superposition of the two notes
Entanglement is a famously counter-intuitive quantum phenomenon describing behavior we never see in the classical world. Entangled particles behave together as a system in ways that cannot be explained using classical logic
Quantum interference can be understood similarly to wave interference; when two waves are in phase, their amplitudes add, and when they are out of phase, their amplitudes cancel


In order to increase the computational power of quantum computing systems, improvements are needed along two dimensions. One is qubit count; the more qubits you have, the more states can in principle be manipulated and stored.
The second is to achieve lower error rates.
Combining these two concepts, we can create a single measure of a quantum computer’s power called quantum volume. Quantum volume measures the relationship between number and quality of qubits, circuit connectivity, and error rates of operations.

https://www.research.ibm.com/ibm-q/learn/what-is-quantum-computing/


  • Quantum Computation

Rather than store information using bits represented by 0s or 1s as conventional digital computers do, quantum computers use quantum bits, or qubits, to encode information as 0s, 1s, or both at the same time.
Capabilities
Optimization
Machine learning
Sampling / Monte Carlo
Pattern recognition and anomaly detection
Cyber security
Image analysis
Financial analysis
Software / hardware verification and validation
Bioinformatics / cancer research
https://www.dwavesys.com/quantum-computing