Linux-for-Sys-Ads/C2/Creating-user-account/English-timed

From Script | Spoken-Tutorial
Revision as of 15:50, 6 September 2022 by PoojaMoolya (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Time Narration
00:01 Hello and welcome to the spoken tutorial on Creating User Account in Linux.
00:08 In this tutorial we will learn about
00:10 Creating user account with different options

slash etc slash passwd file, slash etc slash shadow file

00:22 To record this tutorial, I am using Ubuntu Linux 16.04 OS
00:29 To practice this tutorial, You should have gone through the Linux tutorial series on this website.
00:36 And you must have root access to the computer.
00:41 In an earlier tutorial on basics of system administration, we have learnt

To add a user using the following command:

00:49 Please note that the option field here, is not mandatory.
00:54 We will elaborate on the option field in this tutorial.
00:59 Open the Terminal by pressing Ctrl, Alt and T keys simultaneously on the keyboard.
01:06 First, you should login as superuser or root user.
01:11 To do so type: sudo space su and press Enter.
01:18 Type your password and then press Enter.
01:22 Notice, our login prompt has changed to a hash symbol.
01:27 This indicates that we are in the root user mode.
01:31 Now, let’s consider a scenario of a college.
01:35 We will have students, departments, etc.
01:39 As a system administrator, you should first create a user account for individual students.
01:46 Let’s add one user say amit using adduser command.
01:51 So, on the terminal type: adduser space amit and press Enter
02:00 It will prompt us to type the password for the user amit.
02:04 Let’s type pass underscore amit and press Enter.
02:10 Retype the same password and press Enter.
02:14 When it prompts for the Full Name field, type the name of the user as Amit with A in caps.

Press Enter.

02:23 Leave the other fields empty by pressing the Enter key.
02:28 Press Y to confirm that the information you provided is correct.

Press Enter

02:36 So, we got back our root command prompt.

The user amit is created now.

02:42 Linux automatically assigns a UID or User ID to the user.
02:49 It also creates a home directory for the user in the system’s home folder.

In this case, it is slash home slash amit

03:00 A group is also created with the same name as the username of the user.
03:05 Now, say we want a customized user ID or group
03:11 Or a home directory other than the default one
03:15 Or we want to change the default login shell
03:20 adduser supports options for each of these requirements.
03:25 Also you can combine multiple options to set multiple values in a single command.
03:32 Hyphen u option is used to set user ID
03:37 Hyphen home sets user home directory
03:41 Hyphen shell sets the login shell for the user
03:46 Hyphen c option is used to mention comments
03:51 Let us take an example.
03:53 Say we want to add a user Kaushik with

user ID as 1050

04:00 home directory as testdir
04:04 login shell as slash bin slash sh
04:08 Also add “Kaushik is a re-registered student” in the comments.
04:14 Switch to the terminal.

Let me clear the terminal.

04:18 Type the command as shown here
04:23 Press Enter.
04:26 It will ask you to enter the password for Kaushik.
04:30 I will type the password as pass underscore kaushik

press Enter.

04:37 Retype the same password and press Enter.
04:42 Give the Full Name of the user as Kaushik with K in caps

press Enter.

04:51 And proceed as we have done before.
04:57 So, the user kaushik is created now.
05:01 Now type ls space /home and press Enter.
05:07 Notice, we have a new directory testdir.
05:12 How can we view other information such as user ID, login shell etc.?
05:19 In Linux, all configuration files are stored in simple text files.
05:25 /etc/passwd file contains the entire information about all the user accounts.
05:33 Let us have a look at the /etc/passwd file.
05:37 Switch to the terminal
05:40 Type cat space /etc/passwd and press Enter.
05:48 There will be an entry in this file for every user on the system.
05:53 Our passwd file shows this line for user Amit.
05:58 Each line has seven fields separated by colon.
06:02 Let us understand the fields one by one.
06:06 The first field is the username amit.
06:10 Remember, username should start with a lowercase letter, followed by any number of lowercase letters or digits
06:19 No special character other than underscore is allowed in the username
06:25 You should remember this while you are creating a user account
06:29 The second field is for password.
06:32 An x character indicates that the encrypted hash password is stored in the file /etc/shadow.
06:41 The third field is user ID for that particular user.
06:46 User id 0 is reserved for root user.
06:50 User ids upto 999 are reserved for other administrative or system users.
06:58 Real user account id starts from 1000.
07:02 So, you should specify a number more than 1000 in the adduser command.
07:08 The fourth field stores the primary group id for the user.
07:13 At the fifth place, we have the comments field.
07:17 It basically stores information about the user such as name of the user, room number, phone number, etc.
07:26 The sixth field indicates the home directory for the user.
07:31 At the end, we have the login shell of the user.
07:36 Notice that, we have default values set for user Amit.
07:42 However, user kaushik is created with our customized values.
07:48 Now, let’s have a look at the /etc/shadow file, where the encrypted passwords are stored.
07:57 Type cat space /etc/shadow and press Enter.
08:05 In this file, every line has information about a particular user.
08:10 And each line contains various fields separated by colon.
08:16 The first field is username, which must correspond to username field in /etc/passwd file.
08:25 Notice, the second field is the encrypted password for that user.

Let us skip the other fields for now.

08:33 To exit from the root user access, type exit and press Enter.
08:39 This brings us to the end of this tutorial.

Let us summarize.

08:44 In this tutorial we learnt about- Creating user account with different options like

Specific user id, Specific Home Directory, Specific shell

08:56 And adding comments
08:59 We also learnt about some of the fields in the */etc/passwd and /etc/shadow files.
09:10 As an assignment

Create user ankit with User ID as 1500

09:17 Home directory named ankit underscore newdir
09:22 Login shell as /bin/csh
09:27 Include “Hostel 15” in the comment
09:30 Use a single command to perform all the tasks
09:34 Check the /etc/passwd file for the details of user account ankit
09:41 The video at the following link summarises the Spoken Tutorial project.

Please download and watch it.

09:49 The Spoken Tutorial Project team conducts workshops and gives certificates.

For more details, please write to us.

09:58 Do you have questions in this Spoken Tutorial?

Please visit this site.

10:03 Choose the minute and second where you have the question.

Explain your question briefly.

10:10 Someone from our team will answer them.
10:14 The Spoken Tutorial forum is for specific questions on this tutorial.
10:19 Please do not post unrelated and general questions on them.

This will help reduce the clutter.

10:26 With less clutter, we can use these discussion as instructional material.
10:32 Spoken Tutorial Project is funded by NMEICT, MHRD, Government of India.
10:38 The script has been contributed by Antara and this is Praveen from IIT Bombay signing off.

Thank you for joining.

Contributors and Content Editors

PoojaMoolya