duplicacy init can't use root path of sftp storage
I set up a user just for backups on my sftp server and chrooted it in its home directory so using the root path sounds reasonable but duplicacy crash when doing so.
duplicacy init backup sftp://user@server:custom_port//
runtime error: index out of range goroutine 1 [running]: runtime/debug.Stack(0x22, 0x0, 0x0) /usr/local/go/src/runtime/debug/stack.go:24 +0xa7 runtime/debug.PrintStack() /usr/local/go/src/runtime/debug/stack.go:16 +0x22 github.com/gilbertchen/duplicacy/src.CatchLogException() /Users/chgang/zincbox/go/src/github.com/gilbertchen/duplicacy/src/duplicacy_log.go:183 +0x189 panic(0xc63800, 0x12c79a0) /usr/local/go/src/runtime/panic.go:502 +0x229 github.com/gilbertchen/duplicacy/src.CreateSFTPStorage(0x7ffd57a76253, 0xe, 0x765, 0x7ffd57a76246, 0xc, 0x7ffd57a76267, 0x1, 0x2, 0xc42017a480, 0x3, ...) /Users/chgang/zincbox/go/src/github.com/gilbertchen/duplicacy/src/duplicacy_sftpstorage.go:71 +0x7ee github.com/gilbertchen/duplicacy/src.CreateStorage(0xd7f5b0, 0x7, 0x7ffd57a76238, 0x6, 0x0, 0x0, 0x7ffd57a7623f, 0x29, 0x0, 0x0, ...) /Users/chgang/zincbox/go/src/github.com/gilbertchen/duplicacy/src/duplicacy_storage.go:405 +0xb40 main.configRepository(0xc420284480, 0xc420284401) /Users/chgang/zincbox/go/src/github.com/gilbertchen/duplicacy/duplicacy/duplicacy_main.go:319 +0x5b9 main.initRepository(0xc420284480) /Users/chgang/zincbox/go/src/github.com/gilbertchen/duplicacy/duplicacy/duplicacy_main.go:214 +0x30 github.com/gilbertchen/duplicacy/vendor/github.com/gilbertchen/cli.Command.Run(0xd7ca57, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdafd13, 0x4f, 0x0, ...) /Users/chgang/zincbox/go/src/github.com/gilbertchen/duplicacy/vendor/github.com/gilbertchen/cli/command.go:160 +0x7ea github.com/gilbertchen/duplicacy/vendor/github.com/gilbertchen/cli.(*App).Run(0xc4202ba6c0, 0xc4200c2000, 0x4, 0x4, 0x0, 0x0) /Users/chgang/zincbox/go/src/github.com/gilbertchen/duplicacy/vendor/github.com/gilbertchen/cli/app.go:179 +0x864 main.main() /Users/chgang/zincbox/go/src/github.com/gilbertchen/duplicacy/duplicacy/duplicacy_main.go:2008 +0x584c
Creating a folder in the user's home directory fixes the issue:
duplicacy init backup sftp://user@server:custom_port//backup run without issues
Unrelated: Mentioning how to use a custom port in the Supported storage backends page would be great. I had to search a bit on google
Ran into that issue yesterday as well
Use duplicacy init backup sftp://user@server:custom_port/.