Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #273051 > unrolled thread
| Started by | Marcus Park <marp@privatembox.com> |
|---|---|
| First post | 2024-09-13 14:40 +0200 |
| Last post | 2024-09-13 15:20 +0200 |
| Articles | 5 — 4 participants |
Back to article view | Back to linux.debian.user
scp in crontab problem Marcus Park <marp@privatembox.com> - 2024-09-13 14:40 +0200
Re: scp in crontab problem basti <mailinglist@unix-solution.de> - 2024-09-13 14:50 +0200
Re: scp in crontab problem Marcus Park <marp@privatembox.com> - 2024-09-14 00:30 +0200
Re: scp in crontab problem Greg Wooledge <greg@wooledge.org> - 2024-09-13 15:00 +0200
Re: scp in crontab problem Charles Curley <charlescurley@charlescurley.com> - 2024-09-13 15:20 +0200
| From | Marcus Park <marp@privatembox.com> |
|---|---|
| Date | 2024-09-13 14:40 +0200 |
| Subject | scp in crontab problem |
| Message-ID | <JmdKG-bZ23-7@gated-at.bofh.it> |
Hi list, I have put the private key into my debian VPS (in ~/.ssh/ dir). When I scp a file from this VPS to another one by hand without password, it works. But when I put this scp into crontab, it seems not work. The scp in crontab via private key didn't run as I expect, nothing was copied to peer. Can you help? Thank you. Marcus
[toc] | [next] | [standalone]
| From | basti <mailinglist@unix-solution.de> |
|---|---|
| Date | 2024-09-13 14:50 +0200 |
| Message-ID | <JmdUl-bZ5c-1@gated-at.bofh.it> |
| In reply to | #273051 |
On 13.09.24 14:24, Marcus Park wrote: > Hi list, > > I have put the private key into my debian VPS (in ~/.ssh/ dir). > > When I scp a file from this VPS to another one by hand without password, > it works. > > But when I put this scp into crontab, it seems not work. The scp in > crontab via private key didn't run as I expect, nothing was copied to peer. > > Can you help? > > Thank you. > Marcus > Cron doesn't know anything about your environment variables. You can set PATH or HOME or use absolute paths. /usr/bin/scp -i /home/userYX/.ssh/myKEY root@example.com ... Best regards,
[toc] | [prev] | [next] | [standalone]
| From | Marcus Park <marp@privatembox.com> |
|---|---|
| Date | 2024-09-14 00:30 +0200 |
| Message-ID | <JmmXD-c4C8-1@gated-at.bofh.it> |
| In reply to | #273052 |
basti: > /usr/bin/scp -i /home/userYX/.ssh/myKEY root@example.com ... updated: it's really due to environment issue, after I add the '-i' path to scp, jobs run well now. Thanks basti.
[toc] | [prev] | [next] | [standalone]
| From | Greg Wooledge <greg@wooledge.org> |
|---|---|
| Date | 2024-09-13 15:00 +0200 |
| Message-ID | <Jme41-bZ8r-9@gated-at.bofh.it> |
| In reply to | #273051 |
On Fri, Sep 13, 2024 at 20:24:51 +0800, Marcus Park wrote: > I have put the private key into my debian VPS (in ~/.ssh/ dir). Does this private key have a passphrase? > When I scp a file from this VPS to another one by hand without password, it > works. > > But when I put this scp into crontab, it seems not work. The scp in crontab > via private key didn't run as I expect, nothing was copied to peer. First question: what did the output say? Any output from the cron job should have been mailed to you. If you don't have a mail reader set up on this machine, try "less /var/mail/$LOGNAME" or something. If you don't have local mail delivery set up, fix that. Second question: if the key has a passphrase, are you using an ssh-agent to invoke it normally? The cron job won't have access to your ssh-agent, not without a bunch of additional setup. For automated jobs, you usually need the private key to NOT have a passphrase. And yes, this is a large security concern. You'll have to balance your security needs against your application needs.
[toc] | [prev] | [next] | [standalone]
| From | Charles Curley <charlescurley@charlescurley.com> |
|---|---|
| Date | 2024-09-13 15:20 +0200 |
| Message-ID | <Jmenn-bZui-1@gated-at.bofh.it> |
| In reply to | #273051 |
On Fri, 13 Sep 2024 20:24:51 +0800 Marcus Park <marp@privatembox.com> wrote: > Hi list, > > I have put the private key into my debian VPS (in ~/.ssh/ dir). The private key of what? And to ~/.ssh/ on which computer. you are talking about transferring a file from one computer to another; which one? And why the private key? Usually one transfers the public key from one's own computer to another, and one keeps the private key, well, private. > > When I scp a file from this VPS to another one by hand without > password, it works. > > But when I put this scp into crontab, it seems not work. The scp in > crontab via private key didn't run as I expect, nothing was copied to > peer. Don't tell us what you did, show us. Copy exactly the line(s) from your crontab file and paste it into your email. Did you get an email from cron? If so, show us that. > > Can you help? Not without better information. -- Does anybody read signatures any more? https://charlescurley.com https://charlescurley.com/blog/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.user
csiph-web