Difference between revisions of "Linux-for-Sys-Ads/C2/Creating-user-account/English"
Pravin1389 (Talk | contribs) |
Nancyvarkey (Talk | contribs) |
||
Line 21: | Line 21: | ||
*'''/etc/passwd file''' | *'''/etc/passwd file''' | ||
*'''/etc/shadow file''' | *'''/etc/shadow file''' | ||
− | |||
|- | |- | ||
|| Slide 3: System requirement | || Slide 3: System requirement | ||
Line 27: | Line 26: | ||
|- | |- | ||
|| Slide:4 Prerequisite | || Slide:4 Prerequisite | ||
− | || To practice this tutorial, *You should have gone through the''' Linux '''tutorial series''' '''on this website. | + | || To practice this tutorial, |
+ | *You should have gone through the''' Linux '''tutorial series''' '''on this website. | ||
*And you must have '''root access '''to the computer. | *And you must have '''root access '''to the computer. | ||
− | |||
− | |||
|- | |- | ||
|| Slide 5: | || Slide 5: | ||
Line 61: | Line 59: | ||
|- | |- | ||
|| Highlight # prompt | || Highlight # prompt | ||
− | || Notice, our '''login prompt '''has changed to | + | || Notice, our '''login prompt '''has changed to a '''hash''' symbol. |
This indicates that we are in the '''root user '''mode. | This indicates that we are in the '''root user '''mode. | ||
Line 75: | Line 73: | ||
[Enter] | [Enter] | ||
− | || Let’s add one '''user''' say ''' | + | || Let’s add one '''user''' say '''amit''' using '''adduser command'''. |
So, on the '''terminal '''type: | So, on the '''terminal '''type: | ||
Line 86: | Line 84: | ||
[Enter] | [Enter] | ||
− | || It will prompt us to type the '''password''' for the''' user | + | || It will prompt us to type the '''password''' for the''' user amit.''' |
Let’s type '''pass underscore amit '''and press '''Enter.''' | Let’s type '''pass underscore amit '''and press '''Enter.''' | ||
Line 130: | Line 128: | ||
|| Slide 6a: | || Slide 6a: | ||
− | || Now, say *we want a '''customized user ID '''or '''group ''' | + | || Now, say |
+ | *we want a '''customized user ID '''or '''group ''' | ||
*Or a '''home directory''' other than the default one | *Or a '''home directory''' other than the default one | ||
*Or we want to change the '''default login shell ''' | *Or we want to change the '''default login shell ''' | ||
Line 137: | Line 136: | ||
|- | |- | ||
|| Slide 6b: | || Slide 6b: | ||
− | || *'''adduser''' supports options for each of these requirements. | + | || |
+ | *'''adduser''' supports options for each of these requirements. | ||
*Also you can combine multiple options to set multiple values in a single '''command'''. | *Also you can combine multiple options to set multiple values in a single '''command'''. | ||
|- | |- | ||
|| Slide 7: | || Slide 7: | ||
− | || *'''Hyphen u '''option is used to set '''user ID''' | + | || |
+ | *'''Hyphen u '''option is used to set '''user ID''' | ||
*'''Hyphen home''' sets '''user home directory''' | *'''Hyphen home''' sets '''user home directory''' | ||
*'''Hyphen shell '''sets the '''login shell '''for the '''user''' | *'''Hyphen shell '''sets the '''login shell '''for the '''user''' | ||
Line 151: | Line 152: | ||
|| Let us take an example. | || Let us take an example. | ||
− | Say we want to add a | + | Say we want to add a '''user Kaushik with ''' |
+ | *'''user ID '''as '''1050''' | ||
*'''home directory '''as '''testdir ''' | *'''home directory '''as '''testdir ''' | ||
*'''login shell '''as''' /bin/sh''' | *'''login shell '''as''' /bin/sh''' | ||
Line 168: | Line 170: | ||
|| Switch to the '''terminal.''' | || Switch to the '''terminal.''' | ||
− | Let me clear the terminal. | + | Let me clear the '''terminal'''. |
Type the '''command '''as shown here | Type the '''command '''as shown here | ||
Line 216: | Line 218: | ||
|- | |- | ||
|| Slide 9: | || Slide 9: | ||
− | || How can we view other information such as '''user ID, login shell '''etc.?*In '''Linux''', all '''configuration files '''are stored in simple '''text files'''. | + | || How can we view other information such as '''user ID, login shell '''etc.? |
− | *'''''/etc/passwd'' '''file contains entire information about all the '''user accounts.''' | + | *In '''Linux''', all '''configuration files '''are stored in simple '''text files'''. |
+ | *'''''/etc/passwd'' '''file contains the entire information about all the '''user accounts.''' | ||
|- | |- | ||
Line 243: | Line 246: | ||
|- | |- | ||
|| Slide | || Slide | ||
− | || *The first '''field '''is the '''username amit.''' | + | || |
+ | *The first '''field '''is the '''username amit.''' | ||
*Remember, '''username '''should start with a lowercase letter | *Remember, '''username '''should start with a lowercase letter | ||
*Followed by any number of lowercase letters or digits | *Followed by any number of lowercase letters or digits | ||
Line 259: | Line 263: | ||
|- | |- | ||
|| Slide | || Slide | ||
− | || *'''User id 0''' is reserved for '''root user'''. | + | || |
+ | *'''User id 0''' is reserved for '''root user'''. | ||
*'''User ids '''upto '''999 '''are reserved for other '''administrative '''or '''system users'''. | *'''User ids '''upto '''999 '''are reserved for other '''administrative '''or '''system users'''. | ||
*Real '''user account id''' starts from '''1000'''. | *Real '''user account id''' starts from '''1000'''. | ||
Line 316: | Line 321: | ||
Summary | Summary | ||
− | || In this tutorial we learnt about-*Creating '''user account '''with different options like | + | || In this tutorial we learnt about- |
+ | *Creating '''user account '''with different options like | ||
** Specific '''user id''' | ** Specific '''user id''' | ||
** Specific '''Home Directory''' | ** Specific '''Home Directory''' | ||
Line 327: | Line 333: | ||
Summary | Summary | ||
|| We also learnt about some of the '''fields '''in the *'''/etc/passwd '''and | || We also learnt about some of the '''fields '''in the *'''/etc/passwd '''and | ||
− | *'''/etc/shadow '''files | + | *'''/etc/shadow '''files. |
|- | |- | ||
Line 336: | Line 342: | ||
|| As an assignment | || As an assignment | ||
− | Create '''user ankit '''with *'''User ID '''as '''1500''' | + | Create '''user ankit '''with |
+ | *'''User ID '''as '''1500''' | ||
*'''Home directory '''named '''ankit underscore newdir''' | *'''Home directory '''named '''ankit underscore newdir''' | ||
*'''Login shell '''as '''/bin/csh''' | *'''Login shell '''as '''/bin/csh''' | ||
Line 342: | Line 349: | ||
|- | |- | ||
|| Slide 18: | || Slide 18: | ||
− | || *Include''' “Hostel 15”''' in the '''comment''' | + | || |
+ | *Include''' “Hostel 15”''' in the '''comment''' | ||
*Use a single '''command''' to perform all the tasks | *Use a single '''command''' to perform all the tasks | ||
*Check the''' /etc/passwd''' file for the details of '''user account ankit''' | *Check the''' /etc/passwd''' file for the details of '''user account ankit''' |
Latest revision as of 16:11, 31 August 2018
Title of script: Creating User Account
Author: Antara Roy Choudhury
Keywords: Creating user account, Different options, Specify user ID, Specify home directory, Specify login shell, Specify comments, /etc/passwd, /etc/shadow
Visual Cue | Narration |
Slide 1: Introduction | Hello and welcome to the spoken tutorial on Creating User Account in Linux. |
Slide 2: Learning Objectives | In this tutorial we will learn about
|
Slide 3: System requirement | To record this tutorial, I am using Ubuntu Linux 16.04 OS |
Slide:4 Prerequisite | To practice this tutorial,
|
Slide 5: | In an earlier tutorial on basics of system administration, we have learnt
adduser space option space username*Please note that the option field here, is not mandatory.
|
Press Ctrl+Alt+T | Open the Terminal by pressing Ctrl, Alt and T keys simultaneously on the keyboard. |
Type
sudo su [Enter] |
First, you should login as superuser or root user.
To do so type: sudo space su and press Enter. |
Type
Password of your account [Enter] |
Type your password and then press Enter. |
Highlight # prompt | Notice, our login prompt has changed to a hash symbol.
This indicates that we are in the root user mode. |
Slide with a block diagram to explain the scenario | Now, let’s consider a scenario of a college.
We will have students, departments, etc. As a system administrator, you should first create a user account for individual students. |
adduser amit
[Enter] |
Let’s add one user say amit using adduser command.
So, on the terminal type: adduser space amit and press Enter |
Type
pass_amit [Enter] |
It will prompt us to type the password for the user amit.
Let’s type pass underscore amit and press Enter. |
Retype the same password
[Enter] |
Retype the same password and press Enter. |
Type
Amit [Enter] |
When it prompts for the Full Name field, type the name of the user as Amit with A in caps.
Press Enter. Leave the other fields empty by pressing the Enter key. |
Press Y | Press Y to confirm that the information you provided is correct.
Press Enter |
On getting # prompt back | So, we got back our root command prompt.
The user amit is now created. |
Highlight appropriately in the output of previous command | Linux automatically assigns a UID or User ID to the user. |
Highlight appropriately in the output of previous command | It also creates a home directory for the user in the system’s home folder.
In this case, it is /home/amit |
Highlight appropriately in the output of previous command | A group is also created with the same name as the username of the user. |
Slide 6a: | Now, say
|
Slide 6b: |
|
Slide 7: |
|
Slide 8: | Let us take an example.
Say we want to add a user Kaushik with
|
Type:
adduser -u 1050 -home /home/testdir/ -shell /bin/sh -c "Re-Registered student" kaushik [Enter] |
Switch to the terminal.
Let me clear the terminal. Type the command as shown here Press Enter. |
Type
pass_kaushik [Enter] |
It will ask you to enter the password for Kaushik.
I will type the password as pass underscore kaushik press Enter. |
Type
pass_kaushik [Enter] |
Retype the same password and press Enter. |
Type Kaushik
[Enter] |
Give the Full Name of the user as Kaushik with K in caps
press Enter. |
Press Enter | And proceed as we have done before. |
Show the output | So, the user kaushik is created now. |
Type:
ls /home/ [Enter] |
Now type ls space /home and press Enter.
|
Slide 9: | How can we view other information such as user ID, login shell etc.?
|
cat /etc/passwd
[Enter] |
Let us have a look at the /etc/passwd file.
Switch to the terminal Type cat space /etc/passwd and press Enter. |
Show file opened
And scroll down until you see user amit and kaushik Highlight rows |
There will be an entry in this file for every user on the system.
Our passwd file shows this line for user Amit. Each line has seven fields separated by colon. Let us understand the fields one by one. |
Slide |
You should remember this while you are creating a user account |
Slide | The second field is for password.
An x character indicates that the encrypted hash password is stored in the file /etc/shadow. |
Slide | The third field is user ID for that particular user. |
Slide |
|
Slide | The fourth field stores the primary group id for the user.
At the fifth place, we have the comments field. It basically stores information about the user such as name of the user, room number, phone number, etc. |
Slide | The sixth field indicates the home directory for the user.
At the end, we have the login shell of the user. |
Switch to terminal and highlight the rows for amit and kaushik | Notice that, we have default values set for user Amit.
However, user kaushik is created with our customized values. |
Type
cat /etc/shadow |
Now, let’s have a look at the /etc/shadow file, where the encrypted passwords are stored.
Type cat space /etc/shadow and press Enter. |
Show the output and highlight | In this file, every line has information about a particular user.
And each line contains various fields separated by colon. The first field is username, which must correspond to username field in /etc/passwd file. |
(Suppose the entry looks like this
Amit:yh65fgtr) Then highlight yh65fgtr |
Notice, the second field is the encrypted password for that user.
Let us skip the other fields for now. |
Type exit and press Enter | To exit from the root user access, type exit and press Enter. |
Retain same screen | This brings us to the end of this tutorial.
Let us summarize. |
Display Slide 16:
Summary |
In this tutorial we learnt about-
|
Display Slide 16:
Summary |
We also learnt about some of the fields in the */etc/passwd and
|
Slide 17:
Assignment |
As an assignment
Create user ankit with
|
Slide 18: |
|
Slide 19: About Spoken Tutorial project | The video at the following link summarises the Spoken Tutorial project.
Please download and watch it. |
Slide 20: Spoken Tutorial workshops | The Spoken Tutorial Project team conducts workshops and gives certificates.
For more details, please write to us. |
Slide: Forum for specific questions: | Do you have questions in this Spoken Tutorial?
Please visit this site. Choose the minute and second where you have the question. Explain your question briefly. Someone from our team will answer them. |
Slide: Forum for specific questions: | The Spoken Tutorial forum is for specific questions on this tutorial.
Please do not post unrelated and general questions on them. This will help reduce the clutter. With less clutter, we can use these discussion as instructional material. |
Slide 22: Acknowledgement | Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.
More information on this mission is available at this link. |
Slide 23: Thank You | The script has been contributed by Antara and this is Praveen from IIT Bombay signing off.
Thank you for joining. |