Tag Archivio per: Add

NIS, an abbreviation for Network Information Service, is a distributed database that helps you to maintain configuration files consistently in your networks. It provides a mainframe-client indexing service that store and circulates the server configuration information. Notably, it helps to manage the host and client names between machines in a PC network environment.

With the previous introductory information, it is right to conclude that NIS provides management and lookup services for the users within a network. But this is only possible merienda you add the user credentials to your database.

This article will provide a step-by-step guide on adding the users to your NIS system. Besides, it will also discuss how you can check the users within your system or find a specific user within the network.

Adding NIS Users to an NIS Domain

You can follow these steps to add a new user to your Linux NIS domain:

Step 1: Log in on the Master Server

You can only add the users if you have all the privileges of an administrator. Thus, begin by becoming an administrator on the master server. Notably, you can do this by creating your NIS profile during the NIS configuration.

Step 2: Create a New User

Proceed to create a new user using the useradd command. The utility creates the entries with relevant user credentials in the /etc/passwd file and the /etc/shadow profile. The following command illustrates this step and you can replace the userID with the login ID of the user you intend to add:

Step 3: Create a Password for the New User

Use the yppasswd command to create a password for the new user. The user will use this password whenever they want to log in. In the following illustration, the UserID specifies the user whose password you are creating. This step is important to ensure that the password created is lockable and useable during logins. The password created with the initial useradd command is not lockable.

Step 4: Copy the Entry into the Master Server

The next step is to copy the new user credentials into your master server’s passwd map files. Your master server’s source files should not be in a /etc file. Proceed to copy the newly created files from both the /etc/passwd and /etc/shadow files onto the passwd input file on your server.

For instance, if you add a new user named Ken, you copy the following line from the /etc/passwd to the passwd input map file:

Similarly, the following line is what you would copy from /etc/shadow to your passwd input map files:

Step 5: Delete Entries from /etc/shadow and /etc/passwd Input Files

It is trascendental to ensure that the Makefile correctly indicates the location of the copied password input file.

Merienda you copy the entries to a map source file stored in a different directory and ascertain their location, you should proceed and delete the entries in both /etc/shadow and /etc/passwd. This action is entirely for security purposes. Delete the entries using the userdel utility on your master server as indicated in the following:

Step 6: Update Your NIS Passwd Maps

Merienda your input files in the master server are updated, you can update the passwd maps using the following command:

The previous steps help add a new user to your NIS system. Merienda through, inform the new user of the initial password assigned to them. They can then login and change the password appropriately.

Finding Users in Your NIS Domain

You can also look up the users in your NIS domain. These two methods come in handy from time to time.

a. Obtaining a List of All Users in the Domain

The ypcat passwd command displays a complete list of the users in your system. You can use it as in the following illustration:

b. Finding a Specific User

You can identify a specific user from your system by running the following command:

For example, you can look up the user named Ken in the NIS system by replacing the “username” in the command with Ken.

If the user named Ken is available, you will receive the following result:

But you can expect the following result in case the user does not exist:


The previous illustrations show how you can add the users to your NIS system. It also shows how you can search and find the users from your systems.


Source link

JavaScript provides a couple of approaches for adding the class name to an HTML element such as the “.add()” method and the “.className” property. Class name can be added to elements using the CSS(cascading style sheet) and JavaScript. The main purpose of adding class name to an HTML element is to achieve different functionalities on the selected element using the specified class name.

The below-listed JavaScript approaches can be used to add the class name to an HTML element:

So, let’s get started!

What is “.add()” in JavaScript?

“.add()” is a built-in method of the classList property that can be used to add the class name to any specific HTML element. The below snippet will let you understand how to use the “.add” method in JavaScript:


How does the “.add()” method work in JavaScript?

This section will present a step-by-step guide to understand how to add the class name to an HTML element using JavaScript.

In this program we will create three files an “html” file, a “CSS” file, and a “JavaScript” file:


<h2>How to add class name to the HTML element through javaScript? </h2>
<button onClick=«classNameFun()»> Click Me! </button>
<h3> clicking on the «Click Me!» button will add the class name to the following p element </h3>
<p id=«addClass»>
Welcome to linuxhint.com!!

In the above snippet we performed the following functionalities:

  • We utilized the <h2> tag to add a heading.
  • Next, we utilized <button> tag to create a button and named it as “Click Me!”.
  • Invoked the “classNameFun()” whenever the user clicked on the button.
  • Next, we created an <h3> element.
  • Finally, we created a paragraph using <p> element and assigned it an id “addClass”.


.style {
    text-align: center;
    font-style: italic;
    background-color: black;
    color: white;

The CSS file served the following functions:

  • Align the text in the center using the “text-align” property.
  • Set the italic font style using “font-style” property.
  • Set the black background color using “background-color” property.
  • Finally, set the white text color using the “color” property.


function classNameFun() {
  let para= document.getElementById(«addClass»);

The .js or JavaScript file served the below-listed functionalities:

  • Created a function named “classNameFun()”.
  • Utilized the getElementByid() method to read/edit an HTML element having an id “addClass”.
  • Finally, utilized the add method to add the name to the <p> element.

On successful execution of the code, initially, we will get the following output:

Clicking on “Click Me!” button will generate the below-given output:

This is how the “.add()” method work in JavaScript.

What is “.className” in JavaScript?

The “.className” is a property in JavaScript that sets/returns the class attributes of an HTML element. It can be used to add/specify the class name to any HTML tag.

The following snippet will show the basic syntax of the “.className” property:

element.className = class_Name;

Here, the “class_Name” represents the name of the class. In case of multiple classes, we can specify the classes name using comma separated syntax.

How does the “.className” property work in JavaScript?

Let’s consider the below given example to get the basic understanding of the “.className” property.


<h3>How to add class name to the HTML element through javaScript? </h3>
<button onClick=«classNameFun()»> Click Me! </button>
<h4 id=«addClass»> clicking on the «Click Me!» button will add the class name to this element </h4>

The HTML class performed the following tasks:

  • Utilized the <h3> element to add a heading.
  • Utilized <button> tag to create a button and named it as “Click Me!”.
  • Invoked the “classNameFun()” whenever the user clicked on the button.
  • finally, created an <h4> and assigned it an id “addClass”.


The CSS file will remain the same as in the previous example.


function classNameFun() {
  let hElement = document.getElementById(«addClass»);
  hElement.className = «style»;

In the JavaScript file, we utilized the getElementById() method to read/edit an HTML element having an id “.addClass”. Afterward, we utilized the add method to add the name to the <p> element.

When we run the above-given program, initially, this program will produce the below-given output:

After clicking on the “Click Me!” button, the classNameFun() will be invoked, consequently, we will get the following output:

The output clarifies that the class name has been added successfully to the <h4> element.


In JavaScript, the “.add()” method and “.className” property are used to add the class name to any HTML element. This write-up explained all the basics for adding class names to any HTML element. This post explained how to use the “.add()” method and “.className” property with the help of some suitable examples.

Source link