-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_samba.sh
More file actions
executable file
·83 lines (69 loc) · 1.81 KB
/
install_samba.sh
File metadata and controls
executable file
·83 lines (69 loc) · 1.81 KB
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
79
80
81
82
#!/bin/bash
# andychen ([email protected])
# date 2015-2-8
# install samba
# by Ubuntu
byUbuntu(){
echo "byUbuntu"
apt-get update
apt-get install samba
mkdir /srv/shareFile
chmod 777 /srv/shareFile
cp -f ./smb.conf /etc/samba/
sed -i "s/dir/srv\/shareFile/g" /etc/samba/smb.conf
cd /srv/shareFile
touch public.txt
echo "this our share file! andychen (`date`)" > /srv/shareFile/public.txt
sercive smbd restart
echo ''
echo '+--------------------------------------+'
echo '| ********** install samba ***********|'
echo '| succeed!! |'
echo '+--------------------------------------+'
echo ''
}
# by Centos
byCentos(){
echo "byCentos"
yum -y install samba
mkdir /srv/shareFile
chmod 777 /srv/shareFile
cp -f ./smb.conf /etc/samba/
sed -i "s/dir/srv\/shareFile/g" /etc/samba/smb.conf
cd /srv/shareFile
touch public.txt
echo "this our share file! andychen (`date`)" > /srv/shareFile/public.txt
/etc/init.d/smb start
echo ''
echo '+--------------------------------------+'
echo '| ********** install samba ***********|'
echo '| succeed!! |'
echo '+--------------------------------------+'
echo ''
}
# 要求用root用户执行
if [ `whoami` != 'root' ];then
echo "+----------------------------+"
echo "| plase use root user |"
echo "+----------------------------+"
exit 1
fi
echo ''
echo '+--------------------------------------+'
echo '| ********** install samba ***********|'
echo '| 1. byUbuntu |'
echo '| 2. byCentos |'
echo '+--------------------------------------+'
read -p 'plase select your system:' option
echo ''
case "$option" in
1)
byUbuntu ;;
2)
byCentos ;;
*)
echo ''
echo "input error! try agin"
echo ''
;;
esac