pallet/pallet — Issue #106: Cannot execute crates with alternate user
Author: kokaku
Created: 2011-12-23 21:05:21+00:00
State: open

Trying to setup an EC2 instance with a different user than the linux user running pallet. The instance is created and can be accessed with the alternate user, but the :configure phase and other lift attempts fail with auth exceptions.

```clojure
(def s (create-cloud-service))
(def g (create-group))
(def u (create-user)) ;; uses make-user to specify public and private keypair
(def r (converge {g 1} :compute s :user u)) ;; creates instance and runs :bootstrap, fails to run :configure
(lift g :compute s :user u :phase (phase-fn (pallet.action.directory/directory "foo"))) ;; also fails
```

Fails with exception below. The converge step succeeds in creating the instance and running the :bootstrap phase but not in running the :configure phase. I am able to ssh to the running instance using the private key specified in create-user; however, ~/.ssh/authorized_keys on the instance is different from the public key specified in create-user. Not sure if that is expected or if that is the cause of the problem.

```
java.util.concurrent.ExecutionException: clojure.contrib.condition.Condition: ssh-fail: server xxx.xx.xxx.xx, port 22, user ec2-user, group :grinder-agent
[Thrown class java.lang.RuntimeException]

Restarts:
0: [QUIT] Quit to the SLIME top level
1: [CAUSE1] Invoke debugger on cause clojure.contrib.condition.Condition: ssh-fail: server xxx.xx.xxx.xx, port 22, user ec2-user, group :grinder-agent [Thrown class java.util.concurrent.ExecutionException]
2: [CAUSE2] Invoke debugger on cause ssh-fail: server xxx.xx.xxx.xx, port 22, user ec2-user, group :grinder-agent [Thrown class clojure.contrib.condition.Condition]
3: [CAUSE3] Invoke debugger on cause Auth fail [Thrown class com.jcraft.jsch.JSchException]

Auth fail
[Thrown class com.jcraft.jsch.JSchException]

Restarts:
0: [QUIT] Quit to the SLIME top level
1: [ABORT] ABORT to SLIME level 0

Backtrace:
0: com.jcraft.jsch.Session.connect(Session.java:461)
1: com.jcraft.jsch.Session.connect(Session.java:154)
2: sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
3: sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
4: sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
5: java.lang.reflect.Method.invoke(Method.java:616)
6: clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:90)
7: clojure.lang.Reflector.invokeNoArgInstanceMember(Reflector.java:265)
8: clj_ssh.ssh$connect.invoke(ssh.clj:261)
9: pallet.execute$ensure_ssh_connection$fn__5701.invoke(execute.clj:346)
10: pallet.execute$ensure_ssh_connection.invoke(execute.clj:345)
```