At work on a Linux server, I try to find a way to execute a script by crontab(in root)
for:
- Log into a local user by ssh with the command
ssh -X user@localhost
- answer at the password question for the user
- execute a command
- wait the end
- exit
ssh
session
I make the process because it works when I do this manually.
I can't use crontab Otherwise than in root.
I try to add a public key for avoid the password step but I don't succeed into.
I must execute my command log into a specific user.
And finally I find a way to get environnement variables with the options -X
... if I log into the specific user with the command su -l user
... my command won't works.
I don't know if I am clear, I am sorry because my knowledge in Linux environments are limited and I try my best to explain to you in an approximate English (I'm French)
Best regards