User Tools

Site Tools


управление_сервисами

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
управление_сервисами [2009/03/05 08:40]
val
— (current)
Line 1: Line 1:
-====== Управление сервисами ====== 
- 
-===== Виды сервисов ===== 
- 
- 
- 
-===== Добавление сервиса к системе ===== 
- 
-  - Инсталяция ПО (не требуется для базового ПО) 
-  - Конфигурация ПО 
-  - Конфигурация /​etc/​rc.conf 
-  - Запуск ПО etc/​rc.d/​сервис start 
- 
-===== Регистрация пользователей в системе ===== 
-  - Программа "​привратник"​ (getty, telnetd, sshd, xdm) 
-  - Программа аутентификации (login, ppp) 
-  - SHELL пользователя (sh, csh, window manager, ...) 
- 
-===== Супердемон inetd ===== 
-<​code>​ 
-[gX:~] # cd /etc 
- 
-[gX:/etc] # cat inetd.conf 
-... 
-telnet ​ stream ​ tcp     ​nowait ​ root    /​usr/​libexec/​telnetd ​   telnetd 
-shell   ​stream ​ tcp     ​nowait ​ root    /​usr/​libexec/​rshd ​      rshd 
-... 
- 
-[gX:/etc] # /​etc/​rc.d/​inetd rcvar  
- 
-[gX:/etc] # cat >> rc.conf ​ 
-inetd_enable="​YES"​ 
- 
-[gX:/etc] # /​etc/​rc.d/​inetd start 
-Starting inetd. 
- 
-Протокол rsh 
-[gX:~] # adduser ​ 
-Username: uY 
-... 
- 
-[gX:~] # telnet gY 
-User (root): uX 
-Password: ​ 
- 
-$ cat .rhosts 
-... 
-gX    root 
-... 
- 
-$ exit 
-Connection closed by foreign host. 
- 
-[gX:~] # rsh -l uX gY "uname -a" 
-</​code>​ 
- 
-==== Использование SHELL и inetd ==== 
- 
-=== telnet сервер === 
-<​code>​ 
-[gX:~] # cat shell.sh 
-#!/bin/sh 
-echo -n "> " 
-while read c 
-do 
-#       $c && echo "​OK"​ 
-        ${c%?} && echo "​OK"​ 
-        echo -n "> " 
-done 
- 
-[gX:/etc] # cat /​etc/​inetd.conf 
-... 
-telnet ​   stream ​ tcp     ​nowait ​ root    /​root/​shell.sh 
-... 
-</​code>​ 
- 
-=== WEB shell === 
-<​code>​ 
-[gX:/etc] # cat /​etc/​inetd.conf 
-... 
-http    stream ​ tcp     ​nowait ​ root /​root/​webshell.sh webshell.sh 
-... 
- 
-[gX:~] # cat webshell.sh 
-#!/bin/sh 
- 
-read s 
-c=$(expr "​$s"​ : "​.*=\(.*\) " | sed "s/+/ /g") 
- 
-if [ "​$c"​ = ""​ ] 
-then 
-echo '<​html><​h1>​Command:</​h1><​form action=""><​input type=text name=command></​form></​html>'​ 
-exit 0 
-fi 
- 
-$c 
-</​code>​ 
- 
-=== http сервер === 
-<​code>​ 
-[gX:/etc] # cat /​etc/​inetd.conf 
-http    stream ​ tcp     ​nowait ​ root /​root/​httpd.sh httpd.sh 
- 
-[gX:~] # cat httpd.sh 
-#!/bin/sh 
- 
-read s 
-c=$(expr "​$s"​ : "​GET..\(.*\) ") 
- 
-if [ "​$c"​ = ""​ ] 
-then 
-    echo "<​html>​ $s <​h1>​shell WebServer</​h1></​html>"​ 
-    exit 0 
-fi 
- 
-if [ -x "/​root/​$c"​ ] 
-then 
-    /root/$c 
-else 
-    cat /root/$c 
-fi  
-</​code>​ 
- 
-===== Служба devd ===== 
-==== Использование shell и devd ==== 
-=== Автомонтирование flash накопителя === 
-<​code>​ 
-[gX:~] # cd /etc 
-[gX:/etc] # mkdir devd 
-[gX:/etc] # cd devd 
- 
-[gX:/​etc/​devd] # cat my.conf ​ 
-attach 30 { 
-        device-name "​umass0";​ 
-        action "sleep 3; /sbin/mount -t msdos /dev/da0s1 /​mnt/";​ 
-}; 
-</​code>​ 
  
управление_сервисами.1236231630.txt.gz · Last modified: 2013/05/22 13:50 (external edit)