TiBeN/CrontabManager

Login with sshkey

mrelliot69 opened this issue · 3 comments

Is it possible to login with x user and also use a sshkey associated with that user to authenticate?

$crontab_adapter = new TiBeN\CrontabManager\CrontabAdapter(user , sshkey ,true);

TiBeN commented

Hi mrelliot69,

This library works locally with the user your PHP runtime is launch. It as no "login" capability of any sort.

I'm not sure what goal you have in mind: you want to be able to modify a crontab from another machine through SSH ?

I want to have it on a machine, already tested but when i do the read of the crontab allways come empty, and i have crons on the crontab, so not sure why its not working.

` $crontab_adapter = new TiBeN\CrontabManager\CrontabAdapter();
$crontabRepository = new TiBeN\CrontabManager\CrontabRepository( $crontab_adapter);

	$cronjobs = $crontabRepository->getJobs();`

Yeah, that was also one of the things that i wanted to do, be able to modify crons from other machines,...

TiBeN commented

Manage crontab's of other machines will never be possible inside the library because it has not been designed to that (It would involve a client/server scheme, networking capabilities etc.) and is out of its scope.

I think the issue you encounter is your PHP runtime (from where you run your code with the lib) is not run with the same UNIX user than the UNIX user your crontab is from. If you are in a web environment (nginx, apache etc.), the runtime user is the one of the web server (typically www-data). That's why supporting sudo was introduced.