SCP failing with error code 126

What happened :
tsh scp isnt working when trying to copy a file from an upstream server.

What you expected to happen :
tsh scp ubuntu@server:~/file.txt .
Must copy a file name file.txt to my local machine

How to reproduce it (as minimally and precisely as possible) :
tsh scp ubuntu@server:~/file.txt .

Environment :

  • Teleport version (use teleport version ): 3.1.1
  • Tsh version (use tsh version ): 3.1.1
  • OS (e.g. from /etc/os-release): Ubuntu 16.04

Browser environment

  • Browser Version (for UI-related issues):
  • Install tools:
  • Others:

Relevant Debug Logs If Applicable

ERROR REPORT:
Original Error: *ssh.ExitError Process exited with status 126
Stack Trace:
	/tmp/20181218T163658/src/github.com/gravitational/teleport/lib/client/client.go:581 github.com/gravitational/teleport/lib/client.(*NodeClient).ExecuteSCP
	/tmp/20181218T163658/src/github.com/gravitational/teleport/lib/client/api.go:1227 github.com/gravitational/teleport/lib/client.(*TeleportClient).SCP
	/tmp/20181218T163658/src/github.com/gravitational/teleport/tool/tsh/tsh.go:747 main.onSCP
	/tmp/20181218T163658/src/github.com/gravitational/teleport/tool/tsh/tsh.go:309 main.Run
	/tmp/20181218T163658/src/github.com/gravitational/teleport/tool/tsh/tsh.go:164 main.main
	/usr/local/go/src/runtime/proc.go:210 runtime.main
	/usr/local/go/src/runtime/asm_amd64.s:1334 runtime.goexit
User Message:
  • tsh --debug
  • teleport --debug

My best guess here is that exit code 126 is referring to a permissions issue when the remote shell tries to run the scp command.

Is this a stock Ubuntu system?
Are you logging in as a regular user or as root?
Are you able to scp the same file from the system using OpenSSH?

Thanks @gus. The issue was we set the umask to 0077 .

1 Like

Glad to hear you got it sorted, and thanks for the feedback!