~ubuntu-branches/ubuntu/hardy/mysql-dfsg-5.0/hardy-updates

« back to all changes in this revision

Viewing changes to scripts/mysql_secure_installation.sh

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2007-04-02 16:10:53 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070402161053-zkil9hjq9k5p1uzv
Tags: 5.0.37-0ubuntu1
* New upstream bugfix release.
  - Fixes replication failure with auto-increment and on duplicate key
    update, a regression introduced into 5.0.24. (LP: #95821)
* debian/control: Set Ubuntu maintainer.
* debian/rules: Change comments from 'Debian etch' to 'Ubuntu 7.04'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
7
 
# the Free Software Foundation; either version 2 of the License, or
8
 
# (at your option) any later version.
 
7
# the Free Software Foundation; version 2 of the License.
9
8
10
9
# This program is distributed in the hope that it will be useful,
11
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
22
21
trap "interrupt" 2
23
22
 
24
23
rootpass=""
 
24
echo_n=
 
25
echo_c=
 
26
 
 
27
set_echo_compat() {
 
28
    case `echo "testing\c"`,`echo -n testing` in
 
29
        *c*,-n*) echo_n=   echo_c=     ;;
 
30
        *c*,*)   echo_n=-n echo_c=     ;;
 
31
        *)       echo_n=   echo_c='\c' ;;
 
32
    esac
 
33
}
25
34
 
26
35
prepare() {
27
36
    touch $config $command
45
54
    status=1
46
55
    while [ $status -eq 1 ]; do
47
56
        stty -echo
48
 
        echo -n "Enter current password for root (enter for none): "
 
57
        echo $echo_n "Enter current password for root (enter for none): $echo_c"
49
58
        read password
50
59
        echo
51
60
        stty echo
65
74
 
66
75
set_root_password() {
67
76
    stty -echo
68
 
    echo -n "New password: "
 
77
    echo $echo_n "New password: $echo_c"
69
78
    read password1
70
79
    echo
71
 
    echo -n "Re-enter new password: "
 
80
    echo $echo_n "Re-enter new password: $echo_c"
72
81
    read password2
73
82
    echo
74
83
    stty echo
173
182
# The actual script starts here
174
183
 
175
184
prepare
 
185
set_echo_compat
176
186
 
177
187
echo
178
188
echo
201
211
echo
202
212
 
203
213
if [ $hadpass -eq 0 ]; then
204
 
    echo -n "Set root password? [Y/n] "
 
214
    echo $echo_n "Set root password? [Y/n] $echo_c"
205
215
else
206
216
    echo "You already have a root password set, so you can safely answer 'n'."
207
217
    echo
208
 
    echo -n "Change the root password? [Y/n] "
 
218
    echo $echo_n "Change the root password? [Y/n] $echo_c"
209
219
fi
210
220
 
211
221
read reply
232
242
echo "production environment."
233
243
echo
234
244
 
235
 
echo -n "Remove anonymous users? [Y/n] "
 
245
echo $echo_n "Remove anonymous users? [Y/n] $echo_c"
236
246
 
237
247
read reply
238
248
if [ "$reply" = "n" ]; then
251
261
echo "ensures that someone cannot guess at the root password from the network."
252
262
echo
253
263
 
254
 
echo -n "Disallow root login remotely? [Y/n] "
 
264
echo $echo_n "Disallow root login remotely? [Y/n] $echo_c"
255
265
read reply
256
266
if [ "$reply" = "n" ]; then
257
267
    echo " ... skipping."
270
280
echo "before moving into a production environment."
271
281
echo
272
282
 
273
 
echo -n "Remove test database and access to it? [Y/n] "
 
283
echo $echo_n "Remove test database and access to it? [Y/n] $echo_c"
274
284
read reply
275
285
if [ "$reply" = "n" ]; then
276
286
    echo " ... skipping."
288
298
echo "will take effect immediately."
289
299
echo
290
300
 
291
 
echo -n "Reload privilege tables now? [Y/n] "
 
301
echo $echo_n "Reload privilege tables now? [Y/n] $echo_c"
292
302
read reply
293
303
if [ "$reply" = "n" ]; then
294
304
    echo " ... skipping."