21
Basic Service & Settings Basic Service & Settings xclin

Basic Service & Settings

  • Upload
    lavina

  • View
    28

  • Download
    0

Embed Size (px)

DESCRIPTION

Basic Service & Settings. xclin. If you want to transfer a file…. By MSN ?. By CS or NCTU’s Web ?. Upload to bsdX and download from www.cs Quota is full!. By FTP Server Inside Your Windows ?. LAG Die! GG. With your own BSD. Configuration Files. Most Common Flow. Install - PowerPoint PPT Presentation

Citation preview

Page 1: Basic Service & Settings

Basic Service & SettingsBasic Service & Settings

xclin

Page 2: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

2

If you want to transfer a file…If you want to transfer a file…

Page 3: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

3

By MSN ?By MSN ?

Page 4: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

4

By CS or NCTU’s Web ?By CS or NCTU’s Web ?

Download

bsdXwww

Upload to bsdX and download from www.csQuota is full!

Page 5: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

5

By FTP Server Inside Your Windows ?By FTP Server Inside Your Windows ?

HDD

Download+FTP Server

LAG

Die!

GG

Page 6: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

6

With your own BSD

FTP / SCPHTTP / FTP

1TB!

Page 7: Basic Service & Settings

Configuration FilesConfiguration Files

Page 8: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

8

Most Common FlowMost Common Flow

1. Install Package, ports and tar-ball

2. Configuration Program specified config file rc.conf

3. Startup

4. Maintenance

Page 9: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

9

Configuration Files (1/3)Configuration Files (1/3)

Local-installed programs’ configuration files can be found in /usr/local/etc• Daemon → program-name.conf

dhcpd.conf

• user-program → program-namerc wgetrc tinrc

Default config file usually installed with .sample or .default suffix• dhcpd.conf.sample

or different suffix for different purpose• php.ini-dist• php.ini-recommended

copy before use it

Page 10: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

10

Configuration Files (2/3)Configuration Files (2/3)

A program with many config files are usually located in /usr/local/etc/program-name/ • apach22

• postfix

Most config files have clear comment at the beginning or before each description

Most popular styles• name <space>value

• name = value

Read documents to know each option’s meaning

Example: proftpd.conf

# Port 21 is the standard FTP port.Port 21

# To prevent DoS attacks, set the maximum # number of child processes to 30. …..MaxInstances 30

Page 11: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

11

Configuration Files (3/3)Configuration Files (3/3)

Some with local effectiveness• Markup language-like

<directory /path>setting-for-this-path…</direction>

• Samba、 rsync

[xxxx]

settings…

[yyyy]

settings….

Page 12: Basic Service & Settings

RC ScriptRC Script

Page 13: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

13

RC ScriptRC Script

start

/etc/rc.d/*

/usr/local/etc/rc.d/*

Sort by rcorder

samba

rsyncd

proftpd

mysql-server

lighttpd

……

include /etc/rc.subr

end

Dependency between each service is described in header of the scriptRcorder is used to find out dependency ordering of each script

Each rc script define what to do when start/stop …/etc/rc.subr defines what to do & check before/after start stop ….

Page 14: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

14

How to use rc script(1/2)How to use rc script(1/2)

Example ntpd>/etc/rc.d/ntpd

Usage: /etc/rc.d/ntpd [fast|force|one](start|stop|restart|rcvar|status|poll)

Rcvar• Display which rc.conf variable are used to control the startup of service• Ex: ntpd_enable=“YES”

pidfile• Record (master) process id of the service

Start Stop Restart

• Start + stop

Page 15: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

15

How to use rc script(2/2)How to use rc script(2/2)

Status• Check the service is running or not

Relaod• Reload configuration file if the service support

One fast force• One

set rcvar = yes Start the service even if XXXX_enable=NO

• Force Set rcvar = yes and

• Fast Skip pid check

Page 16: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

16

Local installed serviceLocal installed service

After install a service by ports, ports will display• This port has installed the following startup scripts which may cause• these network services to be started at boot time.• /usr/local/etc/rc.d/pure-ftpd

Use path-to-rcscript rcvar command to know which variable should set to “YES” to enable this service

For further information, read comments from that script• # Add the following lines to /etc/rc.conf to enable pure-ftpd:• #• # pureftpd_enable="YES"• #• # For launch uploadscript daemon define• # pureftpd_upload_enable="YES"• # pureftpd_uploadscript="/full/path/to/launch_script"

Page 17: Basic Service & Settings

HTTP & FTP (bonus homework)HTTP & FTP (bonus homework)

Due 2009/12/4

Page 18: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

18

FTPFTP

Install proftpd or pure-ftpd

1. Anonymous Login Chrooted (/home/ftp is your root) Can download from /home/ftp/public Can upload & mkdir but no download or delete from /home/ftp/upl

oad Hidden directry /home/ftp/hidden

There is a directory called “target” inside Client can’t list in /home/ftp/hidden/ but can in hidden/target

Page 19: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

19

FTP FTP

2 Create a system user “sysadm” Could login by ssh Password is your student id

3. Create a virtual user “ftp-vip” Chrooted Password is your student-id Can login from 140.113.17.225 & your ip only Full access to /home/ftp Hidden directory is visible to vip

Page 20: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

20

HTTPHTTP

Install Apache22 or Lighttpd Support userdir

• http://your-ip/~username = /home/username/public_html

Files uploaded by FTP-2 can download through HTTP

Page 21: Basic Service & Settings

Com

pu

ter C

en

ter, C

S, N

CTU

21

DemoDemo

Demo with X-window