1clogin(1) General Commands Manual clogin(1)
2
3
4
6 clogin - Cisco/Foundry login script
7
9 clogin [-autoenable] [-noenable] [-dSV] [-c command] [-E var=x] [-e
10 enable-password] [-f cloginrc-file] [-p user-password] [-s script-
11 file] [-t timeout] [-u username] [-v vty-password] [-w enable-
12 username] [-x command-file] [-y ssh_cypher_type] router [router...]
13
15 clogin is an expect(1) script to automate the process of logging into a
16 Cisco router, catalyst switch, Extreme switch, Juniper ERX/E-series,
17 Procket Networks, or Redback router. There are complementary scripts
18 for Alteon, Avocent (Cyclades), Bay Networks (nortel), ADC-kentrox EZ-
19 T3 mux, Foundry, HP Procurve Switches and Cisco AGMs, Hitachi Routers,
20 Juniper Networks, MRV optical switch, Netscreen firewalls, Netscaler,
21 Riverstone, Netopia, and Lucent TNT, named alogin, avologin, blogin,
22 elogin, flogin, fnlogin, hlogin, htlogin, jlogin, mrvlogin, nlogin,
23 nslogin, rivlogin, tlogin, and tntlogin, respectively.
24
25 clogin reads the .cloginrc file for its configuration, then connects
26 and logs into each of the routers specified on the command line in the
27 order listed. Command-line options exist to override some of the
28 directives found in the .cloginrc configuration file.
29
30 The command-line options are as follows:
31
32 -S Save the configuration on exit, if the device prompts at logout
33 time. This only has affect when used with -s.
34
35 -V Prints package name and version strings.
36
37 -c Command to be run on each router list on the command-line.
38 Multiple commands maybe listed by separating them with semi-
39 colons (;). The argument should be quoted to avoid shell
40 expansion.
41
42 -d Enable expect debugging.
43
44 -E Specifies a variable to pass through to scripts (-s). For
45 example, the command-line option -Efoo=bar will produce a global
46 variable by the name Efoo with the initial value "bar".
47
48 -e Specify a password to be supplied when gaining enable privileges
49 on the router(s). Also see the password directive of the
50 .cloginrc file.
51
52 -f Specifies an alternate configuration file. The default is
53 $HOME/.cloginrc.
54
55 -p Specifies a password associated with the user specified by the
56 -u option, user directive of the .cloginrc file, or the Unix
57 username of the user.
58
59 -s The filename of an expect(1) script which will be sourced after
60 the login is successful and is expected to return control to
61 clogin, with the connection to the router intact, when it is
62 done. Note that clogin disables log_user of expect(1)when -s is
63 used. Example script(s) can be found in share/rancid/*.exp.
64
65 -t Alters the timeout interval; the period that clogin waits for an
66 individual command to return a prompt or the login process to
67 produce a prompt or failure. The argument is in seconds.
68
69 -u Specifies the username used when prompted. The command-line
70 option overrides any user directive found in .cloginrc. The
71 default is the current Unix username.
72
73 -v Specifies a vty password, that which is prompted for upon
74 connection to the router. This overrides the vty password of
75 the .cloginrc file's password directive.
76
77 -w Specifies the username used if prompted when gaining enable
78 privileges. The command-line option overrides any user or
79 enauser directives found in .cloginrc. The default is the
80 current Unix username.
81
82 -x Similar to the -c option; -x specifies a file with commands to
83 run on each of the routers. The commands must not expect
84 additional input, such as 'copy rcp startup-config' does. For
85 example:
86
87 show version
88 show logging
89
90 -y Specifies the encryption algorithm for use with the ssh(1) -c
91 option. The default encryption type is often not supported.
92 See the ssh(1) man page for details. The default is 3des.
93
95 If the login script fails for any of the devices on the command-line,
96 the exit value of the script will be non-zero and the value will be the
97 number of failures.
98
100 clogin recognizes the following environment variables.
101
102 CISCO_USER
103 Overrides the user directive found in the .cloginrc file, but
104 may be overridden by the -u option.
105
106 CLOGIN clogin will not change the banner on your xterm window if this
107 includes the character 'x'.
108
109 CLOGINRC
110 Specifies an alternative location for the .cloginrc file, like
111 the -f option.
112
113 HOME Normally set by login(1) to the user's home directory, HOME is
114 used by clogin to locate the .cloginrc configuration file.
115
117 $HOME/.cloginrc Configuration file.
118
120 cloginrc(5), expect(1)
121
123 clogin expects CatOS devices to have a prompt which includes a '>',
124 such as "router> (enable)". It uses this to determine, for example,
125 whether the command to disable the pager is "set length 0" or "term
126 length 0".
127
128 The HP Procurve switches that are Foundry OEMs use flogin, not hlogin.
129
130 The Extreme is supported by clogin, but it has no concept of an
131 "enabled" privilege level. You must set autoenable for these devices
132 in your .cloginrc.
133
134 The -S option is a recent addition, it may not be supported in all of
135 the login scripts or for every target device.
136
138 Do not use greater than (>) or pound sign (#) in device banners. These
139 are the normal terminating characters of device prompts and the login
140 scripts need to locate the initial prompt. Afterward, the full prompt
141 is collected and makes a more precise match so that the scripts know
142 when the device is ready for the next command.
143
144 All these login scripts for separate devices should be rolled into one.
145 This goal is exceedingly difficult.
146
147 The HP Procurve switch, Motorola BSR, and Cisco AGM CLIs rely heavily
148 upon terminal escape codes for cursor/screen manipulation and assumes a
149 vt100 terminal type. They do not provide a way to set a different
150 terminal type or adjust this behavior. The resulting escape codes make
151 automating interaction with these devices very difficult or impossible.
152 Thus bin/hpuifilter, which must be found in the user's PATH, is used by
153 hlogin to filter these escape sequences. While this works for rancid's
154 collection, there are side effects for interactive logins via hlogin;
155 most of which are formatting annoyances that may be remedied by typing
156 CTRL-R to reprint the current line.
157
158 WARNING: repeated ssh login failures to HP Procurves cause the switch's
159 management interface to lock-up (this includes snmp, ping) and
160 sometimes it will crash. This is with the latest firmware; 5.33 at the
161 time of this writing.
162
163
164
165 8 October 2010 clogin(1)