Linux in urud

75
م اس علیکماری ’’ مڈ گ ِ روزا ۔ ا‘‘ ( ا 6517 )

Transcript of Linux in urud

Page 1: Linux in urud

اسالم علیکم

اخبری رشفی یک اکی دحثی ےک اطمقب‘‘ ایل اجےئ یگ۔وج ملع اپھچےئ اگ اےس روِز ایقتم ٓاگ یک اگلم ڈ’’

(6517حیحص ااجلعم دحثی ربمن )

Page 2: Linux in urud

LINUX IS NOT AN OPERATING SYSTEM. IT‘S A PHILOSPHY

Be LinuX Be Free

Page 3: Linux in urud

PRESENTED BY:YAMI GROUP

PRESENTED TO:WHOLE CLASS

Yami Group

Page 4: Linux in urud

PRESENTATION TOPIC

Basic Review of Linux Platform

+

Controlling Access to Files with

Linux File System Permissions

Page 5: Linux in urud

WHAT IS GNU/LINUX?

A free Unix-type operating system developed under the GNU

General Public License.

● Open source

● Popular

● Support most of the platforms available

Page 6: Linux in urud

HISTORY OF BEFORE LINUX

1969

UNIX

1973 UNICS

Converted into Unix

1984

GUN Unix

اقمہلب

1990

Working on Kernel

By

Linus Torvalds

GNO & MINIX

رکلن ںیہن اھت

Memory

Manager creator

Utility of MINIX

and GNO

Rewrite all utility

Of MINIX and GNO

As Competition of UNIX

ور اس یک سکنیل الص ںیم ےہ ایک ا

اترخی ایک ےہ

Assembly language

Write 1st

Ken Thompson,

Dennis Ritchie

In C language

1973, Rewrite UNIX

with C

Richard Stallman

GPL

Hacker

GNU(Free Software

Foundation ) starts

under GPL

Andrew Stuart

"Andy" Tanenbaum

Page 7: Linux in urud

What is Linux/GNU?

1991

Kernel Announcement in

Social Media Group

Comparison of operating systems

https://en.wikipedia.org/wiki/Comparison_of_operating_systems

اس مٹسس اک انم ینعی Linux وک وجڑ رک وک دو اافلظ ےک ادتبایئ رحوفسکنیل

انبای ایگ ےہ۔ الہپ ظفل LINUS ۔ اس ظفل ےہ وج اس مٹسس ےک ابین اک انم ےہ

ںیم ےس نیت ادتبایئ رحوف ینعی LIN ظفلبختنم ےئک ےئگ ںیہ۔ دورسا Unix

اک ففخم ینعی UX ایل ایگ۔ اس رطح ظفل LINUX لیکشت اپات ےہ۔

سکنیل

Linux Distribution

SunOS, Solaris, HP-UX, AIX, SCO UNIX

ء 1994بس ےس الہپ رکلن

ںیم اجری ایک ایگ

ڈنیل وکآرپگنٹی مٹسساس

نِف

ء 1991ےک سنیل وٹرواڈلز ےن

رشوع ایکںیم

Page 8: Linux in urud

LINUX TODAY• Linux has been used for many computing platforms

• PC, Supercomputer

• Commercial vendors moved in Linux itself to provide

freely distributed code. They make their money by

compiling up various software and gathering them in a

distributable format

• Red Hat, Slackware, etc.

• About 29 million people use Linux worldwide

Page 9: Linux in urud

LINUX DISTRIBUTION • Red Hat Linux : One of the original Linux

distribution.

• The commercial, non-free version is Red

Hat Enterprise Linux, which is aimed at

big companies using Linux servers and

desktops in a big way

• Debian GNU/Linux : A free software

distribution. Popular for use on servers

• Gentoo Linux : Gentoo is a specialty

distribution meant for programmers

Page 10: Linux in urud

DISTRIBUTION OF LINUX سکنیل یک میسقت

Page 11: Linux in urud

WHY LINUX ؟ ںیہیک وخایبں ایکسکنیل

Linux Provide Security

Powerful

It’s “free”

Multi-user

Multiprocessing

Multitasking

Multithreading

Linux is Virus Free!!

Page 12: Linux in urud

سکنیل ےک افدئے

سکنیل مٹسس ااہتنیئ مکحتسم ںیہ

سکنیل تفم ےہ

ات۔وارئس اک وکیئ رطخہ ںیہن اور اکیف وکیسرئ ےہ بلطم وارئس اکیٹ ںیہن رک

بصن آات ےہسکنیل ےک اسھت رضورت ےک اسٹف ورئی یک بس ےس زایدہ ےلہپ ےس

مک از مک وتق ےک اسھت اےنپ امتم اسٹف ورئی اپ ڈٹی

سکنیل یھبک ںیہن تسس وہ ات۔

سکنیل یھب بس ےس رپاین اہرڈ ورئی رپ الچ ےتکس ںیہ

س یک رضورت ےہ

کلک

زایدہ اسٹف ورئی وک اشلم رکےن ےک ےئیل ھچک

Page 13: Linux in urud

Some basic Commands in LINUX

Page 15: Linux in urud

SOME BASIC COMMANDS IN LINUX Command Name Description

1. su

Example: su then Pswd yami

رپُس ویزر ےس ولنِگ وہےن ےک ےئیل۔۔۔۔۔

2. mkdir

Example: mkdir yami

۔۔۔این وفڈلر اورڈارئرٹکیی انبےن ےک ےئیل۔۔

3. pwd

Example: pwd and press enter

۔۔۔۔ورگنک ڈارئرٹکیی کیچ رکےن ےک ےئیل ۔

4. ls and enter ۔۔ٹسل وک اظرہ رک یت ےہ وج وج اکم مہ رک رےہ وہں

5. touch

Example: touch yami

اجیت ےہ۔اکی اخیل افلئ انبےن ےک ےئیل اامعتسل یک

6. ls –l and enter ڈلیٹی ٹسل وک اظرہ رک یت ےہ ۔۔۔۔۔

7. “cd” or “cd ..” and press Ent. اپھت رک دبتلی رکےن ےک ےئیل۔۔۔۔۔

Page 16: Linux in urud

SOME BASIC COMMANDS IN LINUX Command Name Description

8. rm file-name

Example: rm yami

یسک یھب افلئ وک ڈٹیلی رکےن ےئیل۔۔۔۔۔

9. rm –r folder-name

Example : rm –r yami

۔۔۔۔۔یسک یھب اخیل وفڈلر وک ڈٹیلی رکےن ےئیل

10. rm –rf folder-name

Example: rm –rf yami

یسک یھب وفڈلر وک ڈٹیلی رکےن ےئیل۔۔۔۔۔

11.date and press Ent. و رکواےن ےک ےئیل۔۔۔۔۔ُ

ڈٹی اور اٹمئ ش

12. date m/d/t/year ڈٹی اور اٹمئ دبتلی رکواےن ےک ےئیل۔۔۔۔۔

13. Clear or Reset …… ر رکےن ےک ےئیل۔۔۔۔۔ ی

ئ

رکسنی وک لک

14. cal year-name و رکواےن ےک ےئیل اور آےگ اسل ھکلُ

دں۔ڈنیلکر ش

Page 17: Linux in urud

SOME BASIC COMMANDS IN LINUX Command Name Description

15. cal m/year-name و رکواےن ےک ےئیل اور آےگ اسل ھکل دںُ

ڈنیلکر ش

16. cp s-file d-file

Example : cp yami df

یسک یھب افلئ و وفڈلر وک اکیپ رکےن ےئیل۔۔۔۔۔

17. cat filename

Example : cat yami

و رکواےن ےک ےئیل۔۔۔۔۔ُ

ش

ٹٹ

افلئ ےک اکن

18. head yami

Example : head yami

و رکواےن ےک ےئیل۔۔۔۔۔10افلئ یک یلہپ ُ

الزنئ ش

19. tail yami

Example : tail yami

و رکواےن ےک ےئیل۔۔۔۔۔10افلئ یک آرخی ُ

الزنئ ش

20. head –n yami or tail b

Example : head –n yami

و رکواےن ےک ےئیل۔۔۔۔۔ُ

بختنم الزنئ وک ش

Page 18: Linux in urud

SOME BASIC COMMANDS IN LINUX Command Name Description

21. wc –w file name

Example : wc –w yami

و ررکوایت ےہ۔۔۔۔۔۔ُ

افلئ ےک وٹلٹ اافلظ ش

22. wc –l file name

Example : wc –l yami

و ررکوایت ےہ۔۔۔۔۔۔ُ

افلئ یک وٹلٹ الزنئ ش

23. wc –c file name

Example : wc –c yami

و رکواےن ےک ےئیل۔۔۔۔۔ُ

افلئ ےکرکرٹکیش

24. wc file name

Example : wc yami

ورکواےن ےک ےئیل۔۔۔۔۔ُ

افلئ یک لمکم ولعمامت ش

25. tail yami

Example : tail yami

و رکواےن ےک ےئیل۔۔۔۔۔10افلئ یک آرخی ُ

الزنئ ش

26. vi file name

Example : vi zubi

س ےک ےئیل۔۔۔۔۔افلئ انبےن اور ڈاٹی اڈی رکواےن ےک ےئیل اور وفحم

ظ

Page 19: Linux in urud

زئ وہریہ ےسیک اپرنشیٹ ےسیک انبےت ںیہ اور اُاکن اس

دےتھکی ںیہ

Page 20: Linux in urud

SOME BASIC COMMANDS IN LINUX

Command Name Description

27. useradd u-name

Example : useradd yami

این ویزر اڈی رکےن ےئلیک۔۔۔۔۔۔

28. passwd u-name

Example : passwd yami

اپوسرڈ اڈی رک ےن ےئلیک۔۔۔۔۔۔

29. cat , more, vi, view,

Example :vi /etc/passwd

ک ڈن وک ویز رکے۔۔۔افلئ وک دےنھکی اور افلئ وک اڈیٹ رکےن واےطس اس امک

30. userdel –r/f u-name

Example : userdel –r /f yami

اےنپ ویزر وک ڈٹیلی رکےن ےئلیک ۔۔۔۔۔

31. usermod –s /sbin/nologin u-

name

Example : usermod –s

/sbin/nologin zubi

ویزر وک ڈس البی رکےنےئلیک۔۔۔۔۔

Page 21: Linux in urud

سکنیل اک ڈارئرٹکیی ارٹسرچک

رے ںیم رپناش رظ آےت ںیہ۔اس ےک ڈارئرٹکیی ارٹسارچک ےک اباجےنن واےل سکنیل ےک ارثک ےئن ےئن

اخص وطر رپ وہ اصرف وج وک ڈنوز اامعتسل رکےن ےک اعدی وہےکچ وہں۔

شیپ دختم ےہڈاھہچن‘‘ ڈارئرٹکیاییت‘‘ےک ےئل اہیں سکنیل اک رصتخم ٹی والوں –آئی

وج آپ وک سکنیل ےک اینبد ےنھجمس ںیم تہب اعمو اثتب وہاگ۔

Page 23: Linux in urud

روٹ / :

ات ےہ۔ امتم ہی روٹ ڈارئرٹکیی ےہ۔ آپ اک امتم مٹسس اس ںیم وموجد وہ

وفڈلرز اک اپھت اس ڈارئرٹکیی ےس رشوع وہات ےہ

Page 24: Linux in urud

ROOT

یک ڈنیب اجبےت ہی روٹ اک رھگ ےہ۔ اہجں روٹ اصبح رےتہ ںیہ اور آپ ےک مٹسس

ںیہ۔ روٹ سکنیل ںیم اڈینم ویزر وک اہک اجات ےہ۔

ہچن وطبر روٹ دامھل اےس مٹسس ںیم دامھل ڈاےنل یک یلھک ااجزت وہیت ےہ۔ انچ

رپ ےچ ان اڑ اجںی۔ڈاےنل ےس ےلہپ مٹسس وک ایھچ رطح اچہپ ںیل ںیہک اس ےک

Page 25: Linux in urud

BIN

ر ایقم ذپری وہیت

یزی

ٹ

یییلی ی

ٹ

ٹ

ںیہ۔ اہیں آپ یک ومعیم سکنیل وی

۔ اہیں ِرڈی اویلن رپورگام یک ابرنئی افںیلئ وموجد وہیت ںیہ

اس ہگج وک امکک ڈن ےک انچہچن بج رٹلنیم ںیم وکیئ امکک ڈن دی اجےئ وت لیش

اماحلص یک التش ںیم دیتھکی ےہ

Page 26: Linux in urud

ETC

• ررنشی ےک ابفگ

کن

رے ںیم وماد و افزلئ یک اہیں رپ امتم االطویقں یک

راہشئ وہیت ےہ۔ انچہچن ارگ آپ ےن samba وت وک ھچک رکان ےہ

ررنشی افںیلئفگ

کن

آپ وک اس یک /etc/samba ںیم التانش

وہیگن۔

Page 27: Linux in urud

DEV

اہیں وموجد وہیگن۔ آپ ےک ویپمکرٹ ےک اہرڈوریئ رپزہ اجت ےک ےلسلس ںیم اسری افںیلئ

۔ےسیج رپرٹن، اہرڈ ڈراویئز، یس ڈی روم وہریہ وہریہ وک ںیہی ےس الچای اجات ےہ

Page 28: Linux in urud

HOME

ا پ یک احتل اس وفڈلر ںیم اصرف اک ذایت ڈاٹی وموجد وہات ےہ۔ اس ےک ذایت ااختنابت، اس

ٹ

کییسیےک ڈ

انم ےک احلظ ےس اکی وہریہ اور اس یک رپوافزلئ ںیہی وفحمظ وہیت ںیہ۔ وہم وفڈلر ںیم رہ اصرف ےک

ا پ یھب وہات ےہ، ایس وفڈل

ٹ

کییسیر ںیم فلتخم رپورگازم ےسیج ذیلی وفڈلر نب اجات ےہ۔ اس وفڈلر ںیم ڈ

ہیفخ ( ہ وموجد وہیت ےہسج ںیم اس ےک کب امرسک اور رٹسہی وہری)ومزالی افرئ افسک یک رپوافلئ

ڈلر وہات ےہ وج وہم ےس وفڈلرز ںیم وموجد وہےت ںیہ۔ روٹ ےک ےیل اہتبل روٹ ےک انم ےس اگل وف

(اورپ اس اک ذرک وہاکچ ےہ۔) اگل ےہ۔

Page 29: Linux in urud

TMP

ر رپ قیلخت رکےت ںیہ اس ہی سکنیل اک اعریض وفڈلر ےہ۔ امتم ڈاٹی اور افںیلئ وج رپورگازم اعریض وط

ںیہ۔ںیم راھک اجات ےہ۔ ضعب ڈِرٹسوز اس وک وصخمص وتق ےک دعب اصف رکدیتی

usr اہیں رپ وہ زیچں آیت ںیہ وج ہن وت: /bin اور ہن یہ /etc ےک ذلی ںیم آیت ںیہ۔ ا ںیم

ذیلی وفڈلرز ںیم میسقت وہات ےہ۔ رپرٹن وییٹیلیٹ یھب وہںیتکس ںیہ اور زمیگ وہریہ یھب۔ ہی وفڈلر آےگ

ےسیج /usr/bin ںیم رپورگازم یک ابرنئی افزلئ وہیت ںیہ۔ /usr/share ںیم رتشمہک ڈاٹی ےسیج

وہریہ وہےت ںیہ۔

ن

ک

ئ

ئ

اسٔوک ڈن افزلئ اور آ /usr/lib ےنلچ ںیم الربئریزی وہیت ںیہ وج رپورگام ےک

ےک ےیل الزیم دراکر وہیت ںیہ۔

Page 30: Linux in urud

OPT

ورژ بصن رکےت ںیہ وت وہ ںیہی ونتیع ےک ںیہ۔ ےسیج آپ افرئ افسک اک اٹیبرپمٹریی اہیں رپ وہ رپورگام بصن وہےت ںیہ وج

ررنشی وک وکیئ ہلئسم ہن وہ۔فگ

کن

بصن وہاگ اتہک آپ ےک مٹسس یک ومعیم

نکیل اگریٹن ںیہن ہک ہی اتزہ اس یک اکی اثمل اونپ آسف ےہ۔ ارگہچ آپ یک ڈرٹِسو ںیم ےلہپ ےس اونپ آسف بصن دشہ وہات ےہ

ف رکےک آلشیف وبی اسٹئ ےس رتنی وہاگ۔ انچہچن اتزہ رتنی اونپ آسف بصن رکےن ےک ےیل آپ وک ےلہپ اینپ ڈرٹسو واال اص

ے وک ڈنوز ںیم رپورگام افزلئ ںیمسی

ج

اکی یہ وفڈلر ںیم اسرا ااترا ورژ بصن رکان ڑپات ےہ۔ وہ ورژ ںیہی رپ بصن وہات ےہ۔

وک ڈنوز یک رپورگام افزلئ رپورگام بصن وہات ےہ یہی احل اس وفڈلر ںیم ااٹسنل وہےن واےل رپورگازم اک وہات ےہ۔ انچہچن آپ

ےک وفڈلر ےس اونپ آسف ےک وفڈلر وک دںیھکی وت ا اک

ش

ڈارئرٹکیی رٹی اکی اسی وہاگ۔ےس اونپ آسف ےک وفڈلر اور آپ

Page 31: Linux in urud

USR/LOCAL

ںیہ ںیھنج اہیں رپ وہ اسٹف ورئی اور ارکسسٹپ وموجد وہےت

ر ےک العوہ بصن ایک ےہ ج

ی

مجج

یک شیٹ

۔ ویزر وفڈلر یک آپ ےن

رڈ اور الربئ ی

ئ

ریزی ےک رطح اس ےک ادنر یھب ابرنئی ، ش

وفڈلر وہےت ںیہ۔

Page 32: Linux in urud

MEDIA

ڈلر ںیم وہیت ںیہ۔اصریف یک رضورت یک اور مک اتیمہ یک احلم زیچں یہ ویزر وللک وف

تہب یس ڈرٹسوز ںیم یہی اکم /mnt اک اسرا وفڈلر ےس ایل اجات ےہ سج ںیم مٹسس

ڈیمای امٔوٹن ایک اجات ےہ۔

ر ںیم ہی اکم وہات ےہ۔ اہیں رپ نکیل اووٹنب سکنیل اور یئک دورسی ڈرٹسوز ںیم ڈیمای ےک وفڈل

س وہریہ آپ یک اہرڈ ڈراویئ اپرزنشیٹ، یس ڈی روم اپرنشیٹ، وی اسی یب اپرنشیٹ

سک

، الفیپ ڈ

امٔوٹن وہیت ںیہ اور ا اک مجح ںیہی رپ اظرہ وہات ےہ۔

Page 33: Linux in urud

اڈیرٹسنمنشی رٹکی

User Administration

System Administration

Network Administration

Page 34: Linux in urud

USER ADMINISTRATION

ایکس دو ااسقم وہیت ںیہ

ٹن 1َ۔مٹسس ااکو

ٹن2َ۔ مٹسک ااکو

ںیم دامھل ڈال اتکس ےہ اور ہی مٹسس ااکوٹن وک امہراآرپگنٹی مٹسس وخد وخبد رکات ےہ ےسیج ہک روٹ اور روٹ وپرے مٹسس

وپرے مٹسس اک امکل وہات ےہ بلطم وپرے مٹسس اک دادا یج ہہک ےتکس ںیہ

جاتح وہات ےہ ۔مٹسک ااکوٹن وک روٹ رکٹی رکات ےہ اور ہی روٹ ےک ےلھت وہات ےہ سج وہج ےس ہی روٹ اک

Page 35: Linux in urud

COMMANDS TO CREATE A CUSTOM ACCOUNT

Command Name Description

1. Useradd or adduser + user-name

Example : useradd yami

ویزر اڈی رکےن ےک ےئیل۔۔۔۔۔۔

یت ںیہ ےسیج یہ مہ این ویزر اڈی رکےت ںیہ وت ہی ھچک افزلئ وخدوخبد نب اج

1. user id (uid)

2. user group (group)

3. create home directory (homedir)

4. shell assignment (shell)

Page 36: Linux in urud

TO CHECK THE USER ID (UID) AND GROUP COMMAND

اڈی رکواےئ ےئگ ویزر وک کیچ رکےن ےک ےئیل

id user-name

# id yami

Page 37: Linux in urud

TO CHANGE THE USER DEFAULT CONFIGURATION

• New Account

• Existing Account

1.New Account:- (-u, -g, -d, -s)

Flag Description

-u To change the user id (uid) default configuration.

-g To change the user group (group) default

configuration.

-d To change the home directory (homedir) default

configuration.

-s To change the default shell of the new user

لی رکےن ےک ےئیل این ویزر یک ڈافیٹل رگیفنکنشی وک دبت

useradd

.امکک ڈن ےک اسھت ذلی ڈنھجوں اامعتسل رکں

Page 38: Linux in urud

ب د

ن

ش

ر یی گف

ن

کن

ز د ی

ن

وز دی

ئ

ن

نل

To change the default uid of the new user:-

# useradd -u 600 zubi

To change the default group of the new

user:-

# useradd -g lab test

To change the default home directory of the new user:-

# useradd -d /home/lab/test test

To change the default shell of the new user:-

# useradd -s /bin/csh test

Single complete command to change all defaults:-

# useradd -u 600 -g lab -d /home/lab/test -s /bin/csh test

Page 39: Linux in urud

EXISTING USER:- (USERMOD COMMAND)

رکےن ےئلیکوموجدہ ویزر یک گنٹیس وک دبتلی

Flag Description

-u To change the user id (uid) configuration.

-g To change the user group (group)

configuration.

-d To change the home directory (homedir)

configuration logically.

-s To change the shell of the existing user

-m physically change the home directory of

the existing user.

# usermod -d /home/test test

In this case home directory is logically moved, but

physically directory does not move.

If we want to physically move the directory, we

will use the following flag with the usermod command.

# usermod -d /home/test -m test

Page 40: Linux in urud

افلئ ںیم وفحمظ وییت ںیہ" اپوسرڈ"ںیم وفحمظ وہیت ےہ۔اور سکنیل ںیم ویزر یک اافنرنشیم “ sam” وک ڈنوز ںیم ویزر یک اافنرنشیم

Passwd file is present in the /etc directory (/etc/passwd).

# more /etc/passwd (read file)

when this command execute, passwd file opens in read mode and shows the all users’

account informations.

Login-name: x : uid : gid :: home-directory-path : shell

Where : is called field separator,

First column shows the login name of the user.

Second column (x) shows authentication, x means password is compulsory.

Third column shows the user id (uid) of the user.

Forth column shows the group id (gid) of the user.

Fifth column is ::, comments are written inside the :: .

Sixth column shows the home directory path.

Seventh column shows the user shell.

User’s Account Information

Passwd File

Page 41: Linux in urud

-c flag is used to write a comment against any user.

Giving Comment to the user:-

# usermod -c “Tech Dept” adnan

* if we do not want the password of any user, then edit the

passwd file and delete the x from the specified user.

Page 42: Linux in urud

ےسک وی ویزر دی گنٹیس

Passwd command is used to set a password to any user.

# passwd user-name

# passwd lab1

after entering new password, confirm password appears to validate the new password.

Only root can use user-name with passwd command, users can’t use the user-name.

Page 43: Linux in urud

# more /etc/shadow

in shadow file

!! blank password.

$1$ password assigned

* password cannot be set.

!!$1$password is locked

ےہاجاتایکوفحمظںیم،افلئیکڈیشوسےجےہاجاتایکوفحمظںیمڈارئرٹکییوہریہورڈاپسےکاصرنیف .

Users’ Passwords are stored in

/etc/shadow file

Page 44: Linux in urud

Account/password Lock

(Temporary)

-l flag is used with passwd command, to lock any account or password.

Syntax:

# passwd -l user-name

Example:

# passwd -l lab1

In /etc/shadow file !!$$ means password is lock.

Page 45: Linux in urud

Account/Password Unlock

-u flag is used with passwd command to unlock a user

account/password.

# passwd -u lab

If shadow is enabled, then all passwords stored in shadow file.

If shadow is disabled, then all passwords stored in password file.

Page 46: Linux in urud

Creating a Group

groupadd command is

used to create a new

group.

Syntax:

# groupadd group-

name

Example:

# groupadd finance

# groupadd tech

To assign a group to existing User:-

# usermod -g finance adnan

A user can have a multiple groups at one time.

A user can be a member of maximum 15 groups

There are two types of groups, primary group and

secondary group

-g flag is used with usermod command for primary

group.

-G flag is used for secondary group.

Add a primary Group:-

# usermod -g acc adnan

Add a secondary Group:-

# usermod -G finance, tech adnan

Page 47: Linux in urud

Delete a Group

groupdel command is used to delete a group. But the

restriction is that it in not the primary group of any user. Only

secondary group can be deleted.

Syntax:

# groupdel group-name

Delete a Group Member

To delete a member of a group, edit the /etc/group file, and

delete the member from the file.

Page 48: Linux in urud

DELETE THE USER

# userdel user-name

# userdel test

س امکک ڈن ےس ڈارئرٹکیی ڈل ںیہن وہیگا

To delete user’s home directory with the user:-

ںیہ وت، مہ اصرف ےک اسھت اصرف ےک رھگ یک ڈارئرٹکیی وک متخ رکان اچےتہ

then we will use –r flag with the userdel command.

# userdel -r test

Page 49: Linux in urud

ل رطےقی انل ویزر ونیک فن

ں دکاں رگا

اڈی رکی دا وا؟؟

Page 50: Linux in urud

SOME BASIC COMMANDS IN LINUX Command Name Description

32. su u name

Example : su zubi

وسچئ ویزر ےس وللک ویزر رپ اجےن ےک ےئیل۔۔۔۔۔۔

33. usermod –s /bin/bash uname

Example : usermod –s /bin/bash zubi

and check by cat

وی زر وک ا البی رکواےن ےک ےئیل۔۔۔۔۔۔

34. cat , more, vi, view,

Example :vi /etc/passwd

ویز رکے۔۔۔افلئ وک دےنھکی اور افلئ وک اڈیٹ رکےن واےطس اس امکک ڈن وک

35. userdel –r/f u-name

Example : userdel –r /f yami

اےنپ ویزر وک ڈٹیلی رکےن ےئلیک ۔۔۔۔۔

36. usermod –s /sbin/nologin u-name

Example : usermod –s /sbin/nologin

zubi

ویزر وک ڈس البی رکےنےئلیک۔۔۔۔۔

Page 51: Linux in urud

SOME BASIC COMMANDS IN LINUX Command Name Description

37. info

Example : info +Enter

و رکواےن ےک ےئیل۔۔۔۔۔۔ُ

اافنرنشیم ش

38. Exit or logout or halt

Example : halt and press enter

اور متخ رکواےن ےک ےئیل۔۔۔۔۔۔َٹش ڈاو

39. cat , more, vi, view,

Example :vi /etc/passwd

ویز رکے۔۔۔افلئ وک دےنھکی اور افلئ وک اڈیٹ رکےن واےطس اس امکک ڈن وک

40. userdel –r/f u-name

Example : userdel –r /f yami

اےنپ ویزر وک ڈٹیلی رکےن ےئلیک ۔۔۔۔۔

41. usermod –s /sbin/nologin u-name

Example : usermod –s /sbin/nologin

zubi

ویزر وک ڈس البی رکےنےئلیک۔۔۔۔۔

Page 52: Linux in urud

SOME BASIC COMMANDS IN LINUX

Command Name Description

42. df [options]

Example : df yami

و رکواےن ےک ےئیل۔۔۔۔ُ

۔۔اامعتسل دشہ سیپس اور ہیقب ہگج ش

43. du [options]

Example : du yami

.۔ینتک ہگج رہ افلئ یتیل ےہ اوکس دےنھکی ےک ےئیل۔۔۔۔

44. less [options] [filename]

Example :less yami

.ےئیل ۔۔۔۔۔۔اکی وتق ںیم اکی افلئ اکی ےحفص ےک وماد وک دےنھکی ےک

45. echo

Example : echo + enter

و رکواےن ےک ےئیل۔۔۔۔۔ُ

آروگٹنم وک ش

46. Man ls

Example : man ls + enter

اخص مسق یک امکک ڈنز وک اجےنن ےک ےئیل ۔۔۔۔۔

Page 53: Linux in urud

SOME BASIC COMMANDS IN LINUX Command Name Description

47. Ps –e

Example : ps –e

و رکواےن ےک ےئیل۔۔۔۔۔۔ُ

امتم رپوسیس ش

48. pstree

Example : pstree + enter

و رکواےن ےل ےئیل۔۔۔۔ُ

۔۔اکی رٹی یک لکش ںیم رپوسس وک ش

49. top

Example :top + enter

و رکواےن ےک ےئیل ۔۔۔ُ

ارٹنویٹکی رپوسس ش

50. vi mycron

Example : vi mycron + Enter

اڈیرٹی امیئ ٹسیب ۔۔۔۔۔۔۔۔۔

51. History

Example : history + enter

رٹسہی کیچ رکےن ےک ےیل ۔۔۔۔۔

Page 54: Linux in urud

SOME BASIC COMMANDS IN LINUX Command Name Description

52. whoami

Example : whoami + enter

و رکواےن ےک ےئیل۔۔۔۔۔۔ُ

رکٹن ویزر ش

53. cat /etc/shells

Example : cat /etc/shells

و رکواےن ےل ےئیل۔۔۔۔۔۔زلش وک ُ

ش

54. top

Example :top + enter

و رکواےن ےک ےئیل ۔۔۔ُ

ارٹنویٹکی رپوسس ش

55. vi mycron

Example : vi mycron + Enter

اڈیرٹی امیئ ٹسیب ۔۔۔۔۔۔۔۔۔

56. History

Example : history + enter

رٹسہی کیچ رکےن ےک ےیل ۔۔۔۔۔

Page 55: Linux in urud

HOW TO CONFIGURE INTERNET IN RHEL

بس ےس ےلہپ اانپ رٹلنیم اونپ رکں

اےنپ ٹین ورک وک کیچ رکےن ےک ےئیل ہی امکک ڈن اگلںی

#service network restart

اور دعب ںیم ااکس

IP

کیچ رکں اس امکک ڈن ےس

# ifconfih

Page 56: Linux in urud
Page 57: Linux in urud

MAIN TOPIC

Controlling Access to Files with

Linux File System Permissions

Page 58: Linux in urud

Types of Permissions:-

There are two types of permissions

• Local Permissions

• Network Permissions

Page 59: Linux in urud

• Local Permissions:-

Within a system or standalone system, permissions

applied are called local permissions.

• Network Permissions:-

Over the network, permissions applied on a system are called

network permissions, i.e., shared device permissions.

Page 60: Linux in urud

Local Permissions

Types of Permissions in Linux:-

Read ( r )

Write ( w )

Execute ( x )

Sequence of permissions is important. We can check the file

properties to see the permissions.

Page 61: Linux in urud

TO SEE THE PROPERTIES:-

# ls -l

First column of properties is the permissions of the file or directory. There are 10 slots of the

permission column. We divide these ten slots into 4 segments.

- - - - - - - - - -

1 slot 3 slots 3 slots 3 slots

• First segment contains only the one slot (first slot only).

• Second segment contains three slots (next three slots).

• Third segment contains three slots (next three slots of remaining).

• Forth segment contains also three slots (last three slots).

Page 62: Linux in urud

1st Segment 2nd Segment:-

If the slot is “–“, then it is a file.

If the slot is “d”, then it is a directory.

If the slot is “l”, then it is a link file (shortcut).

2nd segment shows the owner’s (file creator)

permissions.

rwx means read, write and execute (all

permissions) permissions.

_wx means only write and execute permissions.

_ _ x means only execute permission.

r _ x means only read and execute permissions.

rw_ means only read and write permissions.

_ _ _ means no permissions.

Page 63: Linux in urud

3rd Segment:- 4th Segment:-

3rd segment shows the owner’s primary group

permissions.

rwx means read, write and execute (all

permissions) permissions.

_wx means only write and execute permissions.

_ _ x means only execute permission.

r _ x means only read and execute permissions.

rw_ means only read and write permissions.

_ _ _ means no permissions.

4th Segment:-

4th segment shows the others permissions, other

than owner’s primary group permissions. Others

are also called world users.

rwx means read, write and execute (all

permissions) permissions.

_wx means only write and execute permissions.

_ _ x means only execute permission.

r _ x means only read and execute permissions.

rw_ means only read and write permissions.

_ _ _ means no permissions.

Page 64: Linux in urud

ڈاررٹکیی یک رپنشیم وک کیچ رکان

To Check the Permissions of a File/Directory:-

# ls -l file-name

# ls -l Yami

To Change the Permissions:-

chmod command is used to change any file or directory permissions.

Page 65: Linux in urud

METHODS OF CHANGE PERMISSIONS

Identifier Method

Number System Method

Page 66: Linux in urud

IDENTIFIER METHOD:-

Identifiers which are used are shown below:

• ‘u’ for Owner

• ‘g’ for group

• ‘o’ for others

• ‘a’ for all

Page 67: Linux in urud

THERE ARE THREE PERMISSIONS READ, WRITE AND EXECUTE ARE AVAILABLE IN LINUX.

There are three permissions

read, write and execute are

available in Linux.

Actions:-

Add permissions ‘+’

Remove permissions ‘-‘Syntax:

# chmod

identifier action permission

file/dir-name

Example:-

# chmod g+x Yami

This will add a owner’s primary

group permission execute on abc file.

Example To Add & Remove the

Permissions:-

# chmod u-x, g-x, o+w Yami

Problem:-

Give the read, write and execute

permissions to the owner, give read and

write to primary group and give read

permissions to the others.

Owner = rwx

Group = rw_

Others = r_ _

Solution:-

# chmod u+rwx, g+rw, o+r

Yami

#chmod a+r, u+wx, g+w Yami

output:-

_rwxrw_r_ _

Page 68: Linux in urud

NUMBER SYSTEM METHOD:-

In number system following

numbers are assigned to

each permission.

• r = 4

• w = 2

• x = 1

Full Access or Full

Permission:-

4+2+1 = 7

7 means full access (rwx) as

4+2+1=7

• rw_ is equivalent to 6, as 4+2=6

• r_ _ is equivalent to 4

• r_x is equivalent to 5, as 4+1

• _wx is equivalent to 3, as 2+1=3

• _ _ x is equivalent to 1

• 0 means no permissions

(access)

Example:-

Required Result: _rwx rw_ r_ _

# chmod 764 yami

Example:-

Present Permissions Status:

_ rwx rw_ r_ _

Required Result:

_ rw_ r_ _ r_x

#chmod 645 yami

Page 69: Linux in urud

SPECIAL PERMISSION:- (STICKY BIT)

• It is used on that directory or file on which everyone has full control. i.e. , tmp

directory.

• Delete permission is not given. One user cannot delete other user’s files.

• 1 is used for numeric value of sticky bit.

• Its symbol is “t”. For example, -rwxrwxrwt.

Page 70: Linux in urud

ADD A STICKY BIT:-

If we want to add a sticky bit on the data directory, then we will execute the following

command.

# chmod 1777 data

where “1” is to add a sticky bit.

Remove a Sticky Bit:-

# chmod 777 data

Or # chmod 0777 data

Sticky bit is not applicable on owner of the file or directory.

Page 71: Linux in urud

DEFAULT PERMISSIONS

• In windows OS everyone has by default full control on a file or directory.

• In Linux by default permission on a file is 644 (- rw- r- - r- -).

• And by default permission on a directory is 755 (d rwx r-x r-x).

• Default permissions depend upon umask (user mask) value.

• Default umask is 022

• In the case of directory 777 – 022 = 755

• And in case of file 666 – 022 = 644

• Full access umask is 000.

Page 72: Linux in urud

• By default root has a umask 022

• And regular account’s umask is 002.

• 027,022,002 have some common umask used in Linux.

• In case of directory we subtract the umask value from 777.

• And in the case of a file we subtract the umask value from 666.

• If the resultant value is less than 0, then this will be considered to 0

DEFAULT PERMISSIONS

Page 73: Linux in urud

DEFAULT PERMISSIONS

To see the Umask value:-

# umask

To Change the umask:-

# umask 002

Page 74: Linux in urud

Thank You For

Listening

Page 75: Linux in urud