• No results found

Partitioning. Files on the Hard Drive. Administration of Operating Systems DO2003. Partition = Binder with index. Write file = Insert document

N/A
N/A
Protected

Academic year: 2021

Share "Partitioning. Files on the Hard Drive. Administration of Operating Systems DO2003. Partition = Binder with index. Write file = Insert document"

Copied!
15
0
0

Loading.... (view fulltext now)

Full text

(1)

Wecksten, Mattias 2008

Administration of Operating Systems

DO2003

Mounting the file structure Devices

Wecksten, Mattias 2008

Partitioning

Files on the Hard Drive

• Partition = Binder with index

• Write file = Insert document

• Remove file=

Erase from index

• Format = Replace index

(2)

Wecksten, Mattias 2008

Disk = container of partitions

HDA

HDA1 HDA2 HDA3

Linux MS-dos

Wecksten, Mattias 2008

Partitions

HDA

HDA1 HDA2 HDA3

/home /boot

Mount partitions

• HDD A

• Partition 1, 3 Gig

• Partition 2, 3 Gig

• Partition 3, 15 Gig

• Partition 4, 500 Meg

• CD/DVD

• Floppy

/ /etc

/usr

/home

/media

/mnt/floppy /mnt/cdrom

/boot

(3)

Wecksten, Mattias 2008

mount

• Mount makes it possible to mound devices into the file structure.

mount /dev/hda2 /home mount -t ntfs /dev/hda1 /extra mount -t auto /dev/fd0 /mnt/floppy

mount -t nfs server:/all_home /home mount –t smbfs //ip/path /mountpoint

Wecksten, Mattias 2008

Detailed structuring

Partitions

Minimal setup – Partitions in Linux

• Size

• Required size

• Type

• Filsystem to use

• EXT3

• SWAP

• Mount point

• Where to mount

• /home

(4)

Wecksten, Mattias 2008

Partition example

• Swap

• ~1x volatile memory (desktop).

• 1x - for servers.

• /boot

• Kernels + initrd (small).

• Partition = read only possible

• /usr

• Shared, program installations (large).

• /home

• All user files (large).

• Partition = portable

Wecksten, Mattias 2008

File system commands

• df

• List partitions

• mount

• umount

• showmount

• /etc/fstab

• /etc/mtab

Permissions

Users & groups Permissions Ownership

(5)

Wecksten, Mattias 2008

Users and Groups

Wecksten, Mattias 2008

Users

• Add a user

• Edit /etc/passwd

•Create folders...

• Use adduser

•Use the skel-folder

•Use third party software.

• Deactivate vs. remove users.

/etc/passwd

Name:Password:UserID:PrincipleGroup:Gecos:HomeDirectory:Shell

smith:*:100:100:8A-4(office):/home/smith:/usr/bin/sh guest:*:200:0::/home/guest:/usr/bin/sh

(6)

Wecksten, Mattias 2008

adduser

lygos% sudo adduser kalle Password:

Adding user `kalle'…

Adding new group `kalle' (1004).

Adding new user `kalle' (1004) with group `kalle'.

Creating home directory `/home/kalle'.

Copying files from `/etc/skel' Enter new UNIX password:

Retype new UNIX password:

passwd: password updated successfully Changing the user information for kalle Enter the new value, or press ENTER for the default Full Name []: Kalle Karlsson

Room Number []: D687 Work Phone []: +46-35-123456 Home Phone []: +46-35-234567 Other []:

Is the information correct? [y/N] y

Wecksten, Mattias 2008

Edit groups

• groupadd

• newgrp

• /etc/group

Change password

lygos% passwd kalle

passwd: Changing password for kalle Enter login(NIS) password: ******

New password: ******

Re-enter new password: ******

NIS passwd/attributes changed on the server.

lygos% sudo passwd kalle New password: ******

Re-enter new password: ******

NIS passwd/attributes changed on the server.

lygos% _

(7)

Wecksten, Mattias 2008

useradd – skeleton folder

% ls -A /etc/skel

.bash_profile .bashrc .maildir .screenrc .tcsh.config

% useradd –k adam

% _

• Copies the skeleton to the empty user folder.

Wecksten, Mattias 2008

How to handle MANY users?

How to handle MANY users?

#167

#RNDTXT -> hgR5@%lkoRT5

#CRYPT -> af38$12rsqqK

#167 af3...

(8)

Wecksten, Mattias 2008

How to handle MANY users?

#167

#167 af3...

#uid

#login

#167 af3...

user

admin

Wecksten, Mattias 2008

How to handle MANY users?

hgR

#167

#uid

#login

#167 af3...

CRYPT

Linux File Permissions

(9)

Wecksten, Mattias 2008

Linux file permissions

drwxr-x--- 2 mayank freeos 4096 Dec 28 04:09 tmp -rw-r--r-- 1 mayank freeos 969 Dec 21 02:32 foo -rwxr-xr-x 1 mayank freeos 345 Sep 1 04:12 scr

owner-group-all

r – read. Folders = list. Files = read.

w – write. Folders = change content/remove/change name.

Files = write/remove/change name

x – execute. Fodlers = open. Files = execute.

Wecksten, Mattias 2008

Stickybit

• Prevent

• deleteion

• renaming

• chmod +t fp

setuid / setgid

• Files

• Inherit owners permissions

• Folders

• Inherit group

(10)

Wecksten, Mattias 2008

chmod

raynas.hh.se% chmod 755 testtext.txt raynas.hh.se% ls -la testtext.txt -rwxr-xr-x 1 weck 6 Nov 3 09:31 testtext.txt raynas.hh.se% chmod 700 testtext.txt raynas.hh.se% ls -la testtext.txt -rwx--- 1 weck 6 Nov 3 09:31 testtext.txt raynas.hh.se% _

Wecksten, Mattias 2008

chown

chown -vR owner filename chown owner:group filename

lygos% sudo mkdir /usr/local/pgsql lygos% sudo chown postgres /usr/local/pgsql lygos% sudo chown root:users gemensam

Installation

Software Updates

(11)

Wecksten, Mattias 2008

Install software (RedHat)

• rpm - single packets – rpm –qa – rpm –i <package>

– rpm –U <package>

• yum – packet manager

Wecksten, Mattias 2008

Install software (Debian)

dpkg–packet based

apt-get update - synchronize the databases

apt-get upgrade

apt-get install package

packet manager aptitude - better than apt-get

Basic Process Handeling

(12)

Wecksten, Mattias 2008

Scheduling

RUN

READY WAIT

Wecksten, Mattias 2008

Schedule examples

Schedule examples (priority)

(13)

Wecksten, Mattias 2008

Processes i LINUX

lygos.hh.se% ps -la

F S UID PID PPID C PRI NI ADDR SZ WCHAN TTY TIME CMD 8 O 0 23201 23173 0 50 20 ? 140 pts/6 0:00 ps 8 S 616 15644 15630 0 50 20 ? 1074 ? pts/2 0:05 dtsessio 8 S 616 15904 15643 0 45 20 ? 139 ? pts/2 0:00 sh 8 S 616 15905 15904 0 40 20 ? 1093 ? pts/2 0:08 dtfile 8 S 616 15909 15905 0 40 20 ? 1064 ? pts/2 0:00 dtfile 8 S 616 15630 15627 0 54 20 ? 318 ? pts/2 0:00 tcsh 8 S 616 18612 18611 0 40 20 ? 915 ? pts/2 0:00 dtpad 8 S 616 18611 15643 0 41 20 ? 139 ? pts/2 0:00 sh 8 S 616 15643 1 0 40 20 ? 688 ? pts/2 0:01 ttsessio lygos.hh.se% _

Wecksten, Mattias 2008

top

load averages: 0.00, 0.00, 0.01 23:06:43 48 processes: 47 sleeping, 1 on cpu

CPU states: 100% idle, 0.0% user, 0.0% kernel, 0.0% iowait, 0.0% swap Memory: 256M real, 119M free, 330M swap in use, 318M swap free

PID USERNAME THR PRI NICE SIZE RES STATE TIME CPU COMMAND 13492 weck 1 59 0 2808K 2464K sleep 0:00 0.23% tcsh 13488 root 1 60 0 6096K 2752K sleep 0:00 0.16% sshd 13498 weck 1 59 0 1960K 1248K cpu 0:00 0.14% top_5.9

1 root 1 59 0 1240K 184K sleep 10:59 0.02% init 13490 weck 1 59 0 6224K 2496K sleep 0:00 0.02% sshd 209 root 27 59 0 4712K 3096K sleep 22:06 0.00% nscd 184 root 15 59 0 3504K 1648K sleep 20:14 0.00% syslogd 145 root 1 59 0 2208K 1128K sleep 18:20 0.00% inetd 9029 nobody 1 59 0 3912K 2224K sleep 11:36 0.00% lmgrd 21697 root 1 59 0 3344K 1784K sleep 9:47 0.00% sshd

Process management

• If you start a program from the shell, the shell will wait for the program to exit before you can do anything more.

• To interrupt the program you press <ctrl><c>

• This usually exits the program back to the terminal.

• To suspend the program you press <ctrl><z>

• This puts the process resting in the background and you get back the terminal.

• To restart the program in the foreground again, give the command fg.

• To restart the program in the background, give the command bg.

(14)

Wecksten, Mattias 2008

Background processes

• Start a process as a background process.

lygos.hh.se% netscape &

[1] 23276 lygos.hh.se% _

Wecksten, Mattias 2008

Kill processes

kill pid

lygos.hh.se% ls -R /* > /dev/null &

lygos.hh.se% ps PID TTY TIME CMD 23173 pts/6 0:00 ls 23170 pts/6 0:00 tcsh lygos% kill 23173

[1]Terminated ls -R /* > /dev/null lygos% _

Stop signals

ALRM 14 exit

HUP 1 exit

INT 2 exit (equal to ctrl-c)

KILL 9 exit (this signal can not be caught)

PIPE 13 exit

TERM 15 exit

ABRT 6 core

FPE 8 core

ILL 4 core

QUIT 3 core

SEGV 11 core

TRAP 5 core

lygos% kill -9 23173

[1]Terminated ls -R /* > /dev/null lygos% _

(15)

Wecksten, Mattias 2008

Filtering signals

• To avoid the hup signal you can start a program with nohup.

lygos.hh.se% nohup netscape &

[1] 23276

Sending output to nohup.out lygos.hh.se% _

Wecksten, Mattias 2008

Priority

• Lower

lygos% nice -5 netscape &

• Increase

lygos% sudo nice --5 netscape &

Control priority

lygos.hh.se% ps PID TTY TIME CMD 23173 pts/6 0:00 netscape 23170 pts/6 0:00 tcsh lygos% renice -5 23173 lygos% _

References

Related documents

3 Specification for Instrument Cable 4 Specification for Fibre Optic Cables 5 Specification for Safety Instrument System 6 Specification for Pipeline Leak Detection System 7

user ~ $ sudo apt-get install apache2 user ~ $ sudo a2enmod proxy. user ~ $ sudo

It performs the segmentation iteratively beginning with a coarse view of the data, finding segments using a compression technique, and then recursively considers each discovered

 Relevant risk finance investments in any other company if the money raised by those investments has been employed for the purposes of a trade, and before the date of the

Curve. Click Inferred Dimensions.. Select the two lines. Click to place the dimension. Type 2 in the on-screen input box. From the Dimensions Drop-down list , select

The step of data extraction is responsible for extracting relational social network data and dynamic nature of relations including spatiotemporal data from the mailing lists and

Figure 1 depicts the path to moving from a client server computing model to achieve application fluency in the data center with two important milestones for

Synthetic cannabinoids do not show up on the typical work place drug screen so, if people use these substances instead of the natural form they will not risk positive drug