I'm using an schroot to do some builds of deployment packages, and there's a lot of to and fro between the host and the schroot environments. Within the schroot the ssh-agent doesn't seem to be accessible so every time an ssh key is needed I get asked to enter a password.

As far as I can tell from this http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=574723 the ssh-agent should be working.

I've tried to set things like SSH_AUTH_SOCK and SSH_AGENT_PID, but although the file can be seen within the chroot ssh still asks for the key passphrase.

I've also tried to add in the ssh mounting contrib script to my setup.d, but again, it still asks for the passphrase:

sudo cp /usr/share/doc/schroot/contrib/setup.d/10mount-ssh /etc/schroot/setup.d/
sudo chmod +x /etc/schroot/setup.d/10mount-ssh

I've also tried to rename the 10mount-ssh script to 11mount-ssh so I know it'll happen after the 10mount script runs, but it's still asking.

I'm on raring so have a pretty current version of schroot.


Manually changing SSH_AUTH_SOCK does not work for me, but the flag -p helped in my case.


  1. Copy 10mount-ssh as you did.
  2. ssh-add at host
  3. schroot -p -c <chroot> --automatic-session, so chroot should have the same environment variables as the host (due to -p flag).
  4. hg clone ssh://<login>@<host>:<repo> - command (from chroot) is not asking password.

I had the same problem, looking at the mount-ssh script shows that it needs the environment variables passed either with the -p argument, or by setting preserve-environment=true in the appropriate profile within schroot.conf.

I also had to uncomment the /run bind mount entry from the /etc/schroot/[profile name]/fstab file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.