autoscan icon indicating copy to clipboard operation
autoscan copied to clipboard

Failure to start for users with no home directory

Open Kreeblah opened this issue 2 years ago • 1 comments

When autoscan 1.4.0 runs under a user with no home directory, it fails with the following error:

panic: mkdirall: mkdir /nonexistent: permission denied

goroutine 1 [running]:
main.defaultConfigDirectory({0xace36e, 0x8}, {0xacf1e7, 0xa})
	github.com/cloudbox/autoscan/cmd/autoscan/config.go:27 +0x1d9
main.main()
	github.com/cloudbox/autoscan/cmd/autoscan/main.go:120 +0x2f4

This is even true when passing the --config, --database, and --log flags, so it seems to be hitting https://github.com/Cloudbox/autoscan/blob/master/cmd/autoscan/config.go#L26 and attempting to create directories before checking to see whether it's even relevant that the user has a home directory (which, obviously, is going to fail in this situation). This then causes it to fail to start when running on a system where it has its own user to run as a service, but without login permissions or a home directory, as is the case on FreeBSD.

Kreeblah avatar Nov 01 '23 03:11 Kreeblah

This definitely sounds like a mistake on our end! I’ll look into this over the weekend.

m-rots avatar Nov 01 '23 11:11 m-rots