-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebcam.sh
78 lines (67 loc) · 2.62 KB
/
webcam.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
sudo apt-get install -y lynx
sudo cp -R apache2 /usr/local
#不要なファイルの削除
sudo rm -r /usr/local/apache2/htdocs/*
#必要なディレクトリの作成
sudo mkdir -p /usr/local/apache2/htdocs/images
sudo mkdir -p /usr/local/apache2/htdocs/images2
sudo mkdir -p /usr/local/apache2/downloads
sudo mkdir -p /usr/local/apache2/backup
sudo mkdir -p /usr/local/apache2/cgi-bin
sudo mkdir -p /usr/local/apache2/logs
#必要なファイルのコピー
sudo cp bin/* /usr/local/apache2/cgi-bin/
sudo cp bin/* /usr/local/apache2/backup/
sudo cp httpd.conf /usr/local/apache2/conf/
sudo cp htdocs/* /usr/local/apache2/htdocs/
sudo cp htdocs/* /usr/local/apache2/backup/
sudo cp version.txt /usr/local/apache2/cgi-bin/
sudo cp version.txt /usr/local/apache2/backup/
#ID/PW設定
username="user"
password="password"
htpasswd_file="/usr/local/apache2/htdocs/.htpasswd"
htpasswd -bc "$htpasswd_file" "$username" "$password"
#必要な権限設定
sudo usermod -a -G video daemon
sudo chown daemon:daemon /usr/local/apache2/downloads
sudo chown daemon:daemon /usr/local/apache2/backup
sudo chown daemon:daemon /usr/local/apache2/backup/*
sudo chown daemon:daemon /usr/local/apache2/cgi-bin
sudo chown daemon:daemon /usr/local/apache2/cgi-bin/*
sudo chown daemon:daemon /usr/local/apache2/htdocs
sudo chown daemon:daemon /usr/local/apache2/htdocs/*
sudo chmod 755 /usr/local/apache2/htdocs/images
sudo chmod 755 /usr/local/apache2/htdocs/images2
sudo chmod 775 /usr/local/apache2/downloads
sudo chmod 775 /usr/local/apache2/backup
sudo chmod 755 /usr/local/apache2/cgi-bin/*
sudo chmod 755 /usr/local/apache2/htdocs/*
sudo chmod -R +x /usr/local/apache2/bin
#Apache2を自動起動するための設定
sed -i '/exit 0/d' /etc/rc.local
sed -i '/\/usr\/local\/apache2\/bin\/apachectl restart/d' /etc/rc.local
sed -i '/\/usr\/local\/apache2\/bin\/apachectl start/d' /etc/rc.local
echo "/usr/local/apache2/bin/apachectl start" >> /etc/rc.local
echo "/usr/local/apache2/bin/apachectl restart" >> /etc/rc.local
echo "exit 0" >> /etc/rc.local
# Telnetサーバーをインストール
sudo apt-get install -y xinetd telnetd rsh-server
# Telnetサービスの設定
echo "service telnet
{
flags = REUSE
socket_type = stream
wait = no
user = root
server = /usr/sbin/in.telnetd
log_on_failure += USERID
disable = no
}" | sudo tee /etc/xinetd.d/telnet
# xinetdサービスの再起動
sudo systemctl restart xinetd
# 終了メッセージ
echo "****************************************"
echo "*WebCam has been installed and started.*"
echo "****************************************"