BOSS-Linux/C2/Basics-of-System-Administration/English

From Script | Spoken-Tutorial
Revision as of 10:30, 18 November 2014 by PoojaMoolya (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Title of script: Basics of Systems Administration

Author: Praveen

Keywords: su, adduser, usermod, userdel, UID, GID, du, df, Linux, System Admin, Spoken tutorial, Video tutorial


Visual Cue
Narration
Display Slide 1
Hello and welcome to the Spoken Tutorial on Basics of System Administration with Linux.
Display Slide 2
In this tutorial we will learn the followings.

adduser

su

usermod

userdel

id

du

df

Display Slide 3
I am using Linux for this tutorial.

As a prerequisite please go through the spoken tutorial on

“General Purpose Utilities in Linux” which is available on this website “http://spoken-tutorial.org

One must have admin access in order to execute the commands shown.

Display Slide 4
useradd
Let us first learn how to create a new user.

The “adduser” command will create a new user login for us along with authentication.

We can add any user account with the help of “sudo” command.

Display Slide 5
sudo
Let me give you a brief explanation about the “sudo” command.

Sudo command allows the administrative user to execute a command as a super user.

The sudo command has many options.

We will learn about the options as we go further in this tutorial.

Lets now learn how to create a “New User”.

Switch to the Terminal and Type at the command prompt:
$sudo adduser duck
Open the “Terminal” by pressing the keys “Ctrl, Alt and t” simultaniously on your keyboard

I have already invoked the “Terminal” here.

Here type the command “sudo space adduser” and press Enter .

You will be prompted for a password. I will give the “Admin” password here and Enter.

The typed password on the terminal, is not visible. So we have to type the password carefully.

Once done, a message “adduser : Only one or two names allowed” is displayed.

So let us create a new user account named “duck”.

Type the command :

sudo space adduser space duck, and press Enter.

We have created a new user called “duck”.

In the process of creating a new user, a seperate “home” directory for that user has also been created.

Please note that we will be prompted for a new password for the user “duck”.

Type the password of your choice, in my case im going to type “duck” as the password and press Enter.

Please type the new password again. The password is asked twice for security reasons and for confirmation.

Now our password for the new user is updated. We will be asked for other details too.

But for the time being, I will enter only the “Full Name” as “duck” and leave the rest of the details blank by pressing the Enter key.

Enter.

I will confirm this by entering “y”. This is to confirm that all the information is correct.

Type at the command prompt
$ ls /home
Let us now check, if the user account has been created.

To do this, please type the at the command prompt “ls space /(slash) home” and press Enter.

To show the list of users in the home folder “ls” command is used.

And here is our newly created user named “duck”.

Display Slide 6
su command


Let me switch back to the slides.

Now the next command is the “su”

“su” stands for “Switch User”.

This command is useful for switching from the current user to another user.

Let us go to the Terminal now.

Switch to the terminal
Enter the command “su space hyphen space duck” on the “Terminal” and press Enter.

You will be prompted for a password.

I shall type the user “duck's” password here please recall that it was “duck” itself.

Please notice that, the Terminal switches from the previous user to the new user, which is “duck” in our case.

To logout from this user, type “logout” and hit Enter.

Now the terminal logs out from the current user “duck” and comes back to the previous user account.

which is “vinhai” in our case.

Display Slide 7
usermod command
Let us learn about the “usermod” command.

The “usermod” command:

Enables a super user or root user to modify the settings of other user accounts such as:

Change the password to no password or empty password.

Show the date on which the user account will be disabled

Let us try this command and see.

Type at the command prompt
$sudo usermod -e 2012-12-27 duck
Let me switch to the terminal now.

Let me show you how to set a date of expiry for the user account duck.

Here at the command prompt type

“$sudo space usermod space -(hyphen)e space 2012-(hyphen)12-(hyphen)27 space duck”

and press Enter.

The user account expiry date is set as mentioned in the command here with the help of the option “-e”.

Now you have set an expiry date for the user account “duck”.

Display Slide 8
uid and gid
Let us now talk about the “uid” and “gid” commands.

“id – command” is used to check the identities of all the users and groups

To know about the identity of the user, we use “id space -(hyphen)u”.

To know about the identity of the group users, it is “id space -(hyphen)g”

Now lets work on this.

Type at the command prompt
$id
At the terminal, let us type “id” and press Enter.

Now we can see the User IDs and Group IDs on the system that we are using.

Type at the command prompt
$id -u
To get only the user id, we use “-(hyphen)u” option.

Let us type the command “id space -(hyphen)u” and press enter.

Now we can see only the ids of the users.

But what if we need to know the names of the users?

To find that out, we will type “id space -(hyphen)n space -(hyphen)u” on the terminal here and press Enter.

Now we can see the names of the users instead of their ids.

Type at the command prompt
$id -g
Let us now learn the commands for Group IDs.

Lets type “ id space -(hyphen)g”. Here we can see the group ids.

If we want to view all the current user's group IDs, type “id space -(hyphen) (capital)G” and press Enter.

Please notice that I have typed G in capital letter. See the result for yourself.

Display Slide 9
userdel command
Now let us learn how to delete a user.

For this we use “userdel” command.

We can delete an user account permanently with the help of the “userdel” command.

Lets try this on the terminal.

Type at the command prompt
$sudo userdel -r duck
Here type “sudo space userdel space -(hyphen)r space duck”.

I have used the -(hyphen)r option. This is to remove the user along with his home directory.

Let us press Enter and see what happens.

Now the user “duck” has been deleted. Check this by typing “ls space /(slash)home” and press the Enter.

We will find that, the user account “duck” has been deleted.

Let me go back to the slides now.

Display Slide 10
df and du Commands
Some of the useful commands in Linux System Administration are “df” and “du”

The “df” command gives a report on the free space available on the disk.

And the “du” command gives a report on how much space a file has occupied.

Please try these two commands and find the output for yourself as an assignment.

Type at the command prompt:
$df -h
Let us shift to the terminal, I shall show you a fewuseful options used with the “df” command.

Please type df space -(hyphen)h and press Enter.

Here it shows the size of the File system, and the space is used.

It also shows the space mounted on in a human readable format.

Type at the command prompt
$du -s *.txt
Let us now try some options with the “du” command

At this point i assume that you have created some text files in your home folder.

If not please refer to the tutorial on “General Purpose Utilities in Linux”.

I have already created some text files in my home directory to execute the following command.

Goto “home folder” on the terminal by typing “cd space /(slash) home” and press Enter.

Then type du space -(hyphen)s space *. (astrix dot) txt and press enter.

This command will give you a report on the txt files available in the directory along with its file sizes.

As an assignment, at the command prompt please “du space -(hyphen)ch space *.(astrix dot)txt” and see what happens.

Let me go back to the slides.

Display slide 11 and 12
Summary
To summarise, we have learnt:
  1. “adduser” command to create a new user.
  2. “su” command to switch from one user to another user.
  3. “usermod” command to change the user account settings.
  4. “userdel” command to delete the user account.
  5. id command to know the information about user ids and group ids.
  6. “df” command to check the file system size and its availability.
  7. “du” command to check the space occupied by a file.

This brings us to the end of this tutorial on “Basics of system administration”

Slide 13 and 14
About the Spoken Tutorial Project
The video available at this url,

http://spoken-tutorial.org /What\_is\_a\_Spoken\_Tutorial

Summarises the Spoken Tutorial project.

If you do not have good bandwidth, you can download and watch it.

We conduct workshops using spoken tutorials.

We also give certificates to those who pass an online test.

Please contact us for more details.

Slide 15
Spoken Tutorial is a part of the “Talk to a Teacher” project Supported by the National Mission on Education through ICT (NMEICT), MHRD, Government of India.

More information is available on this url

http://spoken-tutorial.org/NMEICT-Intro

The script for this tutorial has been contributed by Praveen and this is Namita from IIT Bombay signing off.

Thank you for watching.

Contributors and Content Editors

Nancyvarkey, PoojaMoolya