Skip to content

Commit 864ba01

Browse files
committed
driver/shelldriver: dereference symlinks when copying .ssh
cp -a implicitly preserves symlinks during copying. If the authorized_keys file is a symlink, the /tmp/labgrid-ssh/authorized_keys will still point to the ro target of the symlink and adding the key will fail. Add -L to cp to dereference the symlinks. Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
1 parent 1070d36 commit 864ba01

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

labgrid/driver/shelldriver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ def _put_ssh_key(self, keyfile_path):
277277

278278
self.logger.debug("Key not on target and not writeable, using bind mount...")
279279
self._run_check('mkdir -p -m 700 /tmp/labgrid-ssh/')
280-
self._run("cp -a ~/.ssh/* /tmp/labgrid-ssh/")
280+
self._run("cp -aL ~/.ssh/* /tmp/labgrid-ssh/")
281281
self._write_key(keyline, "/tmp/labgrid-ssh/authorized_keys")
282282
self._run_check('chmod 600 /tmp/labgrid-ssh/authorized_keys')
283283
out, err, exitcode = self._run('mount --bind /tmp/labgrid-ssh/ ~/.ssh/')

0 commit comments

Comments
 (0)