@@ -10,30 +10,34 @@ The `clj-ssh.cli` namespace provides some functions for ease of use at the REPL.
10
10
11
11
(use 'clj-ssh.ssh)
12
12
13
- There is a simple ` ssh ` function, which by default, will use the system
14
- ssh-agent.
13
+ Use ` ssh ` to execute a command, say ` ls ` , on a remote host \" my-host\" ,
15
14
16
- (ssh "hostname" "ls")
15
+ (ssh \"my-host\" \"ls\")
16
+ => {:exit 0 :out \"file1\\nfile2\\n\" :err \"\")
17
17
18
- Strict host key checking can be turned off.
18
+ By default this will use the system ssh-agent to obtain your ssh keys, and it
19
+ uses your current username, but this can be specified:
19
20
20
- (default-session-options {:strict-host-key-checking :no})
21
+ (ssh \"my-host\" \"ls\" :username \"remote-user\")
22
+ => {:exit 0 :out \"file1\\nfile2\\n\" :err \"\")
21
23
22
- By default, your current username is used. If your key has a passphrase, and
23
- you are on OSX, then you should be asked for access to your keychain. If you
24
- are on any other OS without a ssh-agent, you will need to explicitly add your
25
- key to the clj-ssh's ssh-agent with the appropriate add-identity call.
24
+ Strict host key checking can be turned off:
26
25
27
- SFTP is supported:
26
+ (default-session-options {:strict-host-key-checking :no})
28
27
29
- ``` clj
30
- (sftp " hostname" :put " /from/this/path" " to/this/path" )
31
- ```
28
+ SFTP is also supported. For example, to copy a local file to a remote host
29
+ \" my-host\" :
30
+
31
+ (sftp \"my-host\" :put \"/from/this/path\" \"to/this/path\")
32
32
33
33
Note that any sftp commands that change the state of the sftp session (such as
34
34
cd) do not work with the simplified interface, as a new session is created each
35
35
time.
36
36
37
+ If your key has a passphrase, you will need to explicitly add your key either to
38
+ the system's ssh-agent, or to clj-ssh's ssh-agent with the appropriate
39
+ ` add-identity ` call.
40
+
37
41
### Non REPL
38
42
39
43
The ` clj-ssh.ssh ` namespace should be using SSH from functional code.
0 commit comments