SECURITY FOR THE LINUX USER | HOW TO SET PASSWORD IN LINUX

STARTING A LINUX SESSION

SECURITY FOR THE LINUX USER: PASSWORDS

The process used to launch a Linux session makes sure that only users with permissions can access the system.

Your login name is shown on the screen when input, making it simple for anyone to find out what it is. As a result, the login process is not a perfect system. Linux solves this issue by allowing you to link your login name and password together for an additional layer of security. When logging in using a password-protected username, you must enter both the password and the username. Linux examines the pair to see whether it is an authorized entry. If the username and password are both provided correctly, the Linux prompt will only show. Otherwise, you will be prompted to enter your login and password again. It is important to note that while entering them, passwords are not visible on the screen.

CHANGING THE USER PASSWORD

A user can also change the password with the passwd command. The following example demonstrates the process of changing the password by the user, cappi:

[cappi@localhost ~]$ passwd

Changing password for user cappi.

Changing password for cappi.

(current) UNIX password:                              [user enters old password here]

New password:                                               [user enters new password here]

Retype new password:                                 [user re-enters new password here]

passwd: all authentication tokens updated successfully

[cappi@localhost ~]$ _

To make sure that only the authorized user is attempting to change the password, the passwd command requests the previous password. Linux displays an error notice, 

Passwd: Authentication token manipulation error, and the Linux prompt appears on the screen if it is unable to recognize the old password, as demonstrated in the following example:

[cappi@localhost ~]$ passwd

Changing password for user cappi.

Changing password for cappi.

(current) UNIX password:                           [user enters the wrong password]

passwd: Authentication token manipulation error


[cappi@localhost ~] $

UNIX asks for retyping a new password. If the passwords do not match, UNIX displays an error message, Sorry, passwords do not match and asks to retype the new password. This is shown in the following example:

[cappi@localhost ~]$ passwd

Changing password for user cappi.

Changing password for cappi.

(current) UNIX password:

New password:                                             [user enters a new password]

Retype new password:                               [user enters the old password]

Sorry, passwords do not match.               [user enters the wrong new password]

New password: _


[root@localhost ~]# passwd cappi

Changing password for user cappi.

New password:                                             [the root user enters a new password]

Retype new password:                                [the root user re-enters the new password]

passwd: all authentication tokens updated successfully.

VIEWING THE SYSTEM DATE AND TIME

Users can display the current date and time by using the date command. The following example demonstrates the date command:

[cappi@localhost ~]$ date

Thu OCT 24 15:56:21 IST 2013

 [cappi@localhost ~] $ _

The options of the date command can be used to format the date and time before displaying them.

The options are specified within double quotes and they must begin with a + symbol.

the month, day, and time in hours and seconds can be referred, to as shown in the following table.

OPTION

DESCRIPTION

%m

Displays month of the year (in digits)

%d

Displays day of the month (in digits)

%y

Displays year (last two digits)

%D

Displays date as mm/dd/yy

%H

Displays hour (00 to 23)

%M

Displays minutes (00 to 59)

%S

Displays seconds (00 to 59)

%T

Displays time as HH.MM.SS

%a

Displays abbreviated weekdays (Sun to Sat)

%h

Displays abbreviated month (Jan to Dec)

%r

Displays time in the AM/PM notation













The following example demonstrates the date command along with its options:

[cappi@localhost ~]$ date "+%T"

11:22:45

[cappi@client1 ~]$ date "+%y"

13

The following example demonstrates messages included within the date command:

[cappi@localhost ~]$ date "+DATE : %D"

DATE: 10/24/13


MODIFYING THE SCREEN

The terminal window screen can be modified by using the following commands:

clear: It is used to clear the terminal screen.

tput clear: It clears the standard output device, and the screen, and positions the cursor at the top left corner of the screen.

tput cup: It is followed by the screen coordinates and positions the cursor at the specified row and column. The following example will position the cursor at row 15 and column 20:

tput cup 15 20

tput smso: It sets the screen to reverse video.

tput rmso: It sets the screen back to normal.

tput blink: It displays a blinking output. Note that this option may not work on a Telnet session.

tput reset: It resets the screen back to the default settings.


IDENTIFYING THE CURRENT USERS WORKING ON THE SYSTEM

The who command is used to display the names of all users who are currently logged in the following example demonstrates the who command:

  • Login name
  • Terminal type and number
  • Date and time when logged in
  • The remote hostname of the terminal from where the user has logged in. Note that this is shown only for users who have not logged in from the server.
The output of the who command also consists of the terminal file name and the date and time the user logged in. The first three users in the example above have terminal types of ttyN, where N is a number between 1 and 12. The ty terminal type is given for users who have logged in from the server. many virtual consoles, also called as terminals, can be used to log on from the server at the same time by many users. Linux allows up to six users to log on to the operating system from the server. Virtual consoles can be invoked by pressing the CtrI+Alt+Ex keys, where x is the number from 1 to 6 of the respective function keys. Switching between consoles is made easier by pressing the Alt key or any of the function keys. Keep in mind that a virtual console can only be accessed from the server.

In the preceding output, pts denotes a remote terminal, which is a computer connected to a computer other than the server.

The Who am I command displays the name of the current user logged in. The following example demonstrates the who am I command:


The options available with the who command are shown below:
  • -m = displays the name of the current user logged in. It is the same as who am i.
  • -q = prints only the login names and the numbers of users logged in.

So that’s it for today guys if you want to learn more about Linux OS follow and stay tuned with guerillateck.com

Thanks for learning give us your feed back?

Identifying the basics of linux part 3 coming soon

No comments:

Post a Comment