Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #273054

Re: scp in crontab problem

From Greg Wooledge <greg@wooledge.org>
Newsgroups linux.debian.user
Subject Re: scp in crontab problem
Date 2024-09-13 15:00 +0200
Message-ID <Jme41-bZ8r-9@gated-at.bofh.it> (permalink)
References <JmdKG-bZ23-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

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

csiph-web