WebDec 9, 2024 · In order to run your command from cron, you'll need to add a no-password entry in sudo. Using sudo visudo, add this: root1 ALL= (ALL:ALL) NOPASSWD: /bin/systemctl start ssh.service. I always use the full path whenever I grant specific sudo command access, so check your system to make sure where systemctl lives. WebI have a script, written in bash, which runs from cron. One of the first things it does is SSH to a remote host and retrieve a list of files in a directory. Everything works fine when run from the command line, but not from cron. The section of …
16.04 - Using ssh in cron script - Ask Ubuntu
WebAdd a comment. 3. Use ssh to gain access to the system you want to edit the crontab on. If required use su to change to an appropriate account. Then something like. export EDITOR=vi crontab -e. see the crontab (5) man page for info on the file itself and the crontab (1) man page for info on the crontab program. Share. WebApr 27, 2024 · 1. ssh-keygen in computer A 2. Left password blank 3. Copied id_rsa.pub to computer B ~/.ssh/ from computer A 4. Renamed id_rsa.pub to authorized_keys in computer B 5. In computer A I did scp -i ~/.ssh/id_rsa -r /var/www/abc abc@ip:/home/abc/ If I do step 4 in commandline its working fine. But when I did same in crontab crossword holiday hampton red roof
ssh - rsync and crontab - Ask Ubuntu
WebDec 7, 2011 · 8. I am using the amazonaws es3 server.I want to schedule my cron with command line. I am using the this command for scheduling the cron job. at -f shellscript.sh -v 18:30. but it will schedule for only one time i want to configure manually like once a day or every five minutes . Please help with command which command i have to used. http://www.uwenku.com/question/p-wzdxxost-ban.html WebHe had problems having crontab (which runs without a terminal) reconnect the tunnels, precisely because he's not using -f, and even if he was, the ssh would exit once the tunnels were setup, without running something - in my case, I go run sleep, for a year. In the script -f must be used WITH A COMMAND that prevents SSH from exiting. builders construction llc