blob: 29f2ba25936694aee23c8668d2cd0152a649c187 [file] [log] [blame]
Vinay Vishal7c4c4fc2019-01-28 12:01:04 +05301type=page
2status=published
3title=setup-ssh
4next=set-web-context-param.html
5prev=setup-local-dcom.html
6~~~~~~
7setup-ssh
8=========
9
10[[setup-ssh-1]][[GSRFM00229]][[setup-ssh]]
11
12setup-ssh
13---------
14
15sets up an SSH key on specified hosts
16
17[[sthref2074]]
18
19Synopsis
20
21[source,oac_no_warn]
22----
23asadmin [asadmin-options] setup-ssh [--help]
24[--sshport ssh-port] [--sshuser ssh-user]
25[--sshkeyfile ssh-keyfile] [--sshpublickeyfile ssh-public-keyfile]
26[--generatekey={false|true}]
27host-list
28----
29
30[[sthref2075]]
31
32Description
33
34The `setup-ssh` subcommand sets up a secure shell (SSH) key on the hosts
35that are specified as the operand of the subcommand. This key enables
36\{product---name} to use public-key authentication for authentication of
37the user's SSH login on remote hosts.
38
39SSH ensures that \{product---name} clusters that span multiple hosts can
40be administered centrally. When a user runs a subcommand for cluster
41administration that acts on multiple hosts, the subcommand is propagated
42from the domain administration server (DAS) host to remote hosts. To
43propagate subcommands that act on a \{product---name} instance that is
44not running, or on a node where no instances are running,
45\{product---name} uses SSH. SSH provides confidentiality and security
46for data that is exchanged between the DAS and remote hosts.
47
48Public-key authentication uses an SSH key pair that comprises the
49following keys:
50
51* A private key, which is stored in a secure location on the DAS host
52and which may be protected with a passphrase
53* The public key, which is stored on all the remote hosts with which the
54DAS communicates
55
56The subcommand does not require any configuration information from the
57DAS and does not modify the configuration of the DAS.
58
59This subcommand is supported in local mode only.
60
61Prerequisites for Using the `setup-ssh` Subcommand
62
63To use the `setup-ssh` subcommand, the SSH user must be able to use SSH
64to log in to remote hosts where SSH is to be set up. Specifically, the
65following prerequisites must be met:
66
67* The
68http://www.oracle.com/pls/topic/lookup?ctx=E18752&id=REFMAN1ssh-1[`ssh`(1)]
69client is installed on the DAS host and is accessible through the DAS
70user's path.
71* The
72http://www.oracle.com/pls/topic/lookup?ctx=E18752&id=REFMAN1Msshd-1m[`sshd`(1M)]
73daemon is installed and running on all hosts where an SSH key is to be
74set up.
75* The user that the `--sshuser` option specifies has an SSH login on all
76hosts where an SSH key is to be set up.
77* The
78http://www.oracle.com/pls/topic/lookup?ctx=E18752&id=REFMAN1ssh-keygen-1[`ssh-keygen`(1)]
79utility is installed on the DAS host either at the default location or
80in a location that is defined in the DAS user's path.
81* On Windows systems, the SSH package for http://www.cygwin.com/[Cygwin]
82(http://www.cygwin.com/) or an http://www.mkssoftware.com/[MKS Software]
83(http://www.mkssoftware.com/) toolkit that provides SSH is installed.
84
85Behavior of the `setup-ssh` Subcommand
86
87The subcommand sets up SSH connectivity between the DAS host and remote
88hosts by automating the following tasks:
89
90* Generating an SSH key pair. If no SSH key pair exists, the default
91behavior of the subcommand is to prompt the user to generate an SSH key
92pair. The SSH key pair is generated without an encryption passphrase. If
93a passphrase-protected key pair is required, the key pair must be
94generated manually by using the SSH
95commandhttp://www.oracle.com/pls/topic/lookup?ctx=E18752&id=REFMAN1ssh-keygen-1[`ssh-keygen`(1)].
96* Distributing the public key. The subcommand appends the content of the
97public key file to the user-home`/.ssh/authorized_keys` file on each
98remote host. By default, the subcommand locates the public key file in
99the user-home`/.ssh` directory on the host where the subcommand is run.
100If the user-home`/.ssh/authorized_keys` file does not exist on a host,
101the subcommand creates the file. user-home is the user's home directory
102on a host. +
103To distribute the public key, authentication of the user's SSH login is
104required. If the private key is protected by a passphrase, the
105passphrase is also required. By default, the subcommand prompts the user
106for the password and, if necessary, the passphrase. To distribute the
107public key without being prompted, run the subcommand as follows:
108
109** Set the `--interactive` option of the
110link:asadmin.html#asadmin-1m[`asadmin`(1M)] utility to `false`.
111
112** Set the `--passwordfile` option of the `asadmin` utility to a file in
113which the `AS_ADMIN_SSHPASSWORD` entry specifies the SSH user's password
114for logging in to the specified hosts.
115
116** If a passphrase is required, ensure that the file that
117`--passwordfile` option of the `asadmin` utility specifies also contains
118an entry for `AS_ADMIN_SSHKEYPASSPHRASE`. +
119If public key authentication is already set up on a host, the subcommand
120informs the user that public key authentication is already set up and
121does not distribute the key to the host.
122
123[[sthref2076]]
124
125Options
126
127asadmin-options::
128 Options for the `asadmin` utility. For information about these
129 options, see the link:asadmin.html#asadmin-1m[`asadmin`(1M)] help page.
130`--help`::
131`-?`::
132 Displays the help text for the subcommand.
133`--sshport`::
134 The port to use for SSH connections to the host where SSH is being set
135 up. The default is 22.
136`--sshuser`::
137 The SSH user on the remote host that is to run the process for setting
138 up SSH on that host. The default is the user that is running this
139 subcommand. To ensure that the DAS can read this user's SSH private
140 key file, specify the user that is running the DAS process.
141`--sshkeyfile`::
142 The absolute path to the SSH private key file for user that the
143 `--sshuser` option specifies. This file is used for authentication to
144 the `sshd` daemon on the host. +
145 The user that is running this subcommand must be able to reach the
146 path to the key file and read the key file. +
147 The default is a key file in the user's `.ssh` directory on the host
148 where the subcommand is run. If multiple key files are found, the
149 subcommand uses the following order of preference: +
150 1. `id_rsa`
151 2. `id_dsa`
152 3. `identity`
153`--sshpublickeyfile`::
154 The absolute path to the SSH public key file for user that the
155 `--sshuser` option specifies. The content of the public key file is
156 appended to the user's `.ssh/authorized_keys` file on each host where
157 SSH is being set up. If the `.ssh/authorized_keys` file does not exist
158 on a host, the subcommand creates the file. +
159 The user that is running this subcommand must be able to reach the
160 path to the key file and read the key file. +
161 The default is a key file in the user's `.ssh` directory on the host
162 where the subcommand is run. If multiple key files are found, the
163 subcommand uses the following order of preference: +
164 1. `id_rsa.pub`
165 2. `id_dsa.pub`
166 3. `identity.pub`
167`--generatekey`::
168 Specifies whether the subcommand generates the SSH key files without
169 prompting the user. +
170 Possible values are as follows: +
171 `true`;;
172 The subcommand generates the SSH key files without prompting the
173 user.
174 `false`;;
175 The behavior of the subcommand depends on whether the SSH key files
176 exist: +
177 * If the SSH key files exist, the subcommand does not generate the
178 files.
179 * If the SSH key files do not exist, the behavior of the subcommand
180 depends on the value of the `--interactive` option of the `asadmin`
181 utility:
182 ** If the `--interactive` option is `true`, the subcommand prompts
183 the user to create the files.
184 ** If the `--interactive` option is `false`, the subcommand fails. +
185 This value is the default.
186
187[[sthref2077]]
188
189Operands
190
191host-list::
192 A space-separated list of the names of the hosts where an SSH key is
193 to be set up.
194
195[[sthref2078]]
196
197Examples
198
199[[GSRFM751]][[sthref2079]]
200
201Example 1   Setting Up an SSH Key
202
203This example sets up an SSH key for the user `gfuser` on the hosts
204`sj03` and `sj04`. The key file is not generated but is copied from the
205user's `.ssh` directory on the host where the subcommand is running.
206
207[source,oac_no_warn]
208----
209asadmin> setup-ssh sj03 sj04
210Enter SSH password for gfuser@sj03>
211Copied keyfile /home/gfuser/.ssh/id_rsa.pub to gfuser@sj03
212Successfully connected to gfuser@sj03 using keyfile /home/gfuser/.ssh/id_rsa
213Copied keyfile /home/gfuser/.ssh/id_rsa.pub to gfuser@sj04
214Successfully connected to gfuser@sj04 using keyfile /home/gfuser/.ssh/id_rsa
215Command setup-ssh executed successfully.
216----
217
218[[GSRFM752]][[sthref2080]]
219
220Example 2   Generating and Setting Up an SSH Key
221
222This example generates and sets up an SSH key for the user `gfuser` on
223the hosts `sua01` and `sua02`.
224
225[source,oac_no_warn]
226----
227asadmin> setup-ssh --generatekey=true sua01 sua02
228Enter SSH password for gfuser@sua01>
229Created directory /home/gfuser/.ssh
230/usr/bin/ssh-keygen successfully generated the identification /home/gfuser/.ssh/id_rsa
231Copied keyfile /home/gfuser/.ssh/id_rsa.pub to gfuser@sua01
232Successfully connected to gfuser@sua01 using keyfile /home/gfuser/.ssh/id_rsa
233Copied keyfile /home/gfuser/.ssh/id_rsa.pub to gfuser@sua02
234Successfully connected to gfuser@sua02 using keyfile /home/gfuser/.ssh/id_rsa
235Command setup-ssh executed successfully.
236----
237
238[[sthref2081]]
239
240Exit Status
241
2420::
243 command executed successfully
2441::
245 error in executing the command
246
247[[sthref2082]]
248
249See Also
250
251link:asadmin.html#asadmin-1m[`asadmin`(1M)]
252
253http://www.oracle.com/pls/topic/lookup?ctx=E18752&id=REFMAN1ssh-1[`ssh`(1)],
254http://www.oracle.com/pls/topic/lookup?ctx=E18752&id=REFMAN1ssh-keygen-1[`ssh-keygen`(1)]
255
256http://www.oracle.com/pls/topic/lookup?ctx=E18752&id=REFMAN1Msshd-1m[`sshd`(1M)]
257
258Cygwin Information and Installation (`http://www.cygwin.com/`), MKS
259Software (`http://www.mkssoftware.com/`)
260
261