2e649f04fed684e0b76546111afee832852738b3
[openwrt-10.03/.git] / target / linux / ps3 / base-files / bin / login
1 #!/bin/sh
2 # Copyright (C) 2008 OpenWrt.org
3
4 bl_option=/sbin/bl-option
5
6 if [ ! -f $bl_option ] ||
7    [ ! `$bl_option --get-telnet-enabled` ] ||
8    [ `$bl_option --get-telnet-enabled` = "0" ]; then
9     echo \
10 "
11  === IMPORTANT ==========================
12   Telnet login is disabled for security
13   reasons. Enabling telnet login on the
14   host will allow any user connected to
15   the same network to login to the host.
16
17   You can enable telnet login with the
18   following command in the host console:
19
20   # $bl_option -T 1
21
22   You can disable telnet login with the
23   following command in the host console:
24
25   # $bl_option -T 0
26  ----------------------------------------
27 "
28     exit 0
29 fi
30
31 grep '^root:[^!]' /etc/passwd >&- 2>&-
32 [ "$?" = "0" -a -z "$FAILSAFE" ]  &&
33 {
34     echo "Login failed."
35     exit 0
36 } || {
37 cat << EOF
38  === IMPORTANT ============================
39   Use 'passwd' to set your login password
40   this will disable telnet and enable SSH
41  ------------------------------------------
42 EOF
43 }
44
45 exec /bin/ash --login