0% found this document useful (0 votes)
13 views17 pages

ch-2 Linux Acess

This document covers system access and user account management in Linux, including logging in and out, creating and managing user accounts and groups, and the necessary commands for these tasks. It explains the importance of user accounts for security and resource management, and provides detailed instructions on how to create users with various specifications such as home directories and user IDs. Additionally, it outlines best practices for password selection and account expiration settings.

Uploaded by

laita nikam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views17 pages

ch-2 Linux Acess

This document covers system access and user account management in Linux, including logging in and out, creating and managing user accounts and groups, and the necessary commands for these tasks. It explains the importance of user accounts for security and resource management, and provides detailed instructions on how to create users with various specifications such as home directories and user IDs. Additionally, it outlines best practices for password selection and account expiration settings.

Uploaded by

laita nikam
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Unit :-2

System Access and


user Account
Unit :-2 System Access
and user account
 Log in And Log Out using the Linux system

 Creating Additional User Account

 Creating And Managing group

 Managing Users Linux Commands


What is a system user?

Make programmatic, automated actions on ad objects or Pages, or do programmatic ads


buying. System users represent servers or software making API calls to assets owned or
managed by a Business Manager. The easiest, quickest way to create a system user is in
the Business Manager tool.

Who is user ?
A user is a person who utilizes a computer or network service. Users of computer systems
and software products generally lack the technical expertise required to fully understand
how they work.
Logging In and Logging Out

To ensure security and organization on a system with many users, Unix machines employ a system of
user accounts. The user accounting features of Unix provide a basis for analysis and control of
system resources, preventing any user from taking up more than his or her share, and preventing
unauthorized people from accessing the system. Every user of a Unix system must get permission by
some access control mechanism.

Logging in

Logging in to a LINUX system requires two pieces of information: A username, and a


password. When you sit down for a Unix session, you are given a login prompt that looks
like this

Login:

Type your username at the login prompt, and press the return key. The system will then ask
you for your password. When you type your password, the screen will not display what you
type.
Your username
Your username is assigned by the person who creates your account. At ISU, the standard username
is the first four letters of your last name concatenated with the first four letters of your first name.
Your username must be unique on the system where your account exists since it is the means by
which you are identified on the system.

Your password
When your account is created, a password is assigned. The first thing you should do is
change your password, using the passwd utility. To change your password, type the
command
passwd

after you have logged in. The system will ask for your old password, to prevent someone
else from sneaking up, and changing your password. Then it will ask for your new
password. You will be asked to confirm your new password, to make sure that you didn't
mistype. It is very important that you choose a good password, so that someone else
cannot guess it. Here are some rules for selecting a good password:
Rules of give to the password

•Do not use any part of your name, your spouse's name, your child's name, your pet's
name, or anybody's name. Do not use any backward spellings of any name, either.

•Do not use an easily-guessable number, like your phone number, your social security
number, your address, license plate number, etc.

•Do not use any word that can be found in an English or foreign-language dictionary.

•Do not use all the same letter, or a simple sequence of keys on the keyboard, like qwerty.

•Do use a mix of upper-case and lower-case letters, numbers, and control characters.

•Do use at least six characters.

If you have accounts on multiple machines, use a different password on each machine. Do
not choose a password that is so difficult to remember that you must write it down.
Logging Out
When you're ready to quit, type the command

exit

Before you leave your terminal, make sure that you see the login prompt, indicating that
you have successfully logged out. If you have left any unresolved processes, the Unix
system will require you to resolve them before it will let you log out. Some shells will
recognize other commands to log you out, like "logout" or even "bye".It is always a good
idea to clear the display before you log out, so that the next user doesn't get a screenful
of information about you, your work, or your user account. You can type the command

clear

right before you log out, or you can press the return key until all the information is
scrolled off the screen.
Types of user add in linux

1. How to Add a New User in Linux

2. Create a User with Different Home Directory

3. Create a User with Specific User ID

4. Create a User with Specific Group ID

5. Add a User to Multiple Groups

6. Add a User without Home Directory

7. Create a User with Account Expiry Date

8. Create a User with Password Expiry Date

9. Add a User with Custom Comments

10. Change User Login Shell:


How to Add a New User in Linux

To add/create a new user, all you’ve to follow the command ‘useradd‘ or ‘adduser‘ with
‘username’. The ‘username’ is a user login name, that is used by user to login into the
system.
Only one user can be added and that username must be unique (different from other
username already exists on the system).
For example, to add a new user called ‘tecmint‘, use the following command.

[ root@tecmint ~]# useradd tecmint


When we add a new user in Linux with ‘useradd‘ command it gets created in locked state
and to unlock that user account, we need to set a password for that account with ‘passwd‘
command.

[root@tecmint ~]# passwd tecmint


Changing password for user tecmint.
New UNIX password:
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
Once a new user created, it’s entry automatically added to the ‘/etc/passwd‘ file. The file is used to
store users information and the entry should be.

tecmint:x:504:504:tecmint:/home/tecmint:/bin/bash
The above entry contains a set of seven colon-separated fields, each field has it’s own meaning. Let’s
see what are these fields:

1.Username: User login name used to login into system. It should be between 1 to 32 charcters
long.

2.Password: User password (or x character) stored in /etc/shadow file in encrypted format.

3.User ID (UID): Every user must have a User ID (UID) User Identification Number. By default UID 0
isreserved for root user and UID’s ranging from 1-99 are reserved for other predefined accounts.
Further UID’s ranging from 100-999 are reserved for system accounts and groups.

4.Group ID (GID): The primary Group ID (GID) Group Identification Number stored in /etc/group file.

5.User Info: This field is optional and allow you to define extra information about the user. For
example, user full name. This field is filled by ‘finger’ command.
1.Home Directory: The absolute location of user’s home directory.
2.Shell: The absolute location of a user’s shell i.e. /bin/bash.

2. Create a User with Different Home Directory

By default ‘useradd‘ command creates a user’s home directory under /home directory
with username. Thus, for example, we’ve seen above the default home directory for the
user ‘tecmint‘ is ‘/home/tecmint‘.

However, this action can be changed by using ‘-d‘ option along with the location of new
home directory (i.e. /data/projects). For example, the following command will create a
user ‘anusha‘ with a home directory ‘/data/projects‘.

[root@tecmint ~]# useradd -d /data/projects Anusha

You can see the user home directory and other user related information like user id, group
id, shell and comments.

[root@tecmint ~]# cat /etc/passwd | grep anusha

anusha:x:505:505::/data/projects:/bin/bash
3. Create a User with Specific User ID

In Linux, every user has its own UID (Unique Identification Number). By default,
whenever we create a new user accounts in Linux, it assigns userid 500, 501, 502 and so
on…
But, we can create user’s with custom userid with ‘-u‘ option. For example, the following
command will create a user ‘navin‘ with custom userid ‘999‘.

[root@tecmint ~]# useradd -u 999 navin

Now, let’s verify that the user created with a defined userid (999) using following
command.

[root@tecmint ~]# cat /etc/passwd | grep navin

navin:x:999:999::/home/navin:/bin/bash
4. Create a User with Specific Group ID

Similarly, every user has its own GID (Group Identification Number). We can create
users with specific group ID’s as well with -g option.
Here in this example, we will add a user ‘tarunika‘ with a
specific UID and GID simultaneously with the help of ‘-u‘ and ‘-g‘ options.

[root@tecmint ~]# useradd -u 1000 -g 500 tarunika


Now, see the assigned user id and group id in ‘/etc/passwd‘ file.

[root@tecmint ~]# cat /etc/passwd | grep tarunika

tarunika:x:1000:500::/home/tarunika:/bin/bash
5. Add a User to Multiple Groups

The ‘-G‘ option is used to add a user to additional groups. Each group name is separated by
a comma, with no intervening spaces.
Here in this example, we are adding a user ‘tecmint‘ into multiple groups
like admins, webadmin and developer.

[root@tecmint ~]# useradd -G admins,webadmin,developers tecmint

Next, verify that the multiple groups assigned to the user with id command.

[root@tecmint ~]# id tecmint

uid=1001(tecmint) gid=1001(tecmint)
groups=1001(tecmint),500(admins),501(webadmin),502(developers)
context=root:system_r:unconfined_t:SystemLow-SystemHigh
6. Add a User without Home Directory

In some situations, where we don’t want to assign a home directories for a user’s, due to
some security reasons. In such situation, when a user logs into a system that has just
restarted, its home directory will be root. When such user uses su command, its login
directory will be the previous user home directory.

To create user’s without their home directories, ‘-M‘ is used. For example, the following
command will create a user ‘shilpi‘ without a home directory.

[root@tecmint ~]# useradd -M shilpi

Now, let’s verify that the user is created without home directory, using ls command.

[root@tecmint ~]# ls -l /home/shilpi

ls: cannot access /home/shilpi: No such file or directory


7. Create a User with Account Expiry Date
By default, when we add user’s with ‘useradd‘ command user account never get expires i.e their
expiry date is set to 0 (means never expired).
However, we can set the expiry date using ‘-e‘ option, that sets date in YYYY-MM-DD format. This is
helpful for creating temporary accounts for a specific period of time.

Here in this example, we create a user ‘aparna‘ with account expiry date i.e. 27th April 2014 in YYYY-
MM-DD format.

[root@tecmint ~]# useradd -e 2014-03-27 Aparna

Next, verify the age of account and password with ‘chage‘ command for user ‘aparna‘ after
setting account expiry date.

[root@tecmint ~]# chage -l aparna

Last password change : Mar 28, 2014


Password expires : never
Password inactive : never
Account expires : Mar 27, 2014
Minimum number of days between password change :0
Maximum number of days between password change : 99999
Number of days of warning before password expires :7
8. Create a User with Password Expiry Date

The ‘-f‘ argument is used to define the number of days after a password
expires. A value of 0 inactive the user account as soon as the password has
expired. By default, the password expiry value set to -1 means never expire.

Here in this example, we will set a account password expiry date i.e. 45
days on a user ‘tecmint’ using ‘-e‘ and ‘-f‘ options.

[root@tecmint ~]# useradd -e 2014-04-27 -f 45 tecmint

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy