Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 12-21-2006, 12:07 PM   #1
Registered: Apr 2005
Posts: 57

Rep: Reputation: 15
Cronjob / script question

Hi All,
I have many location servers that we do nightly backups on and then scp the file to a central server. I have created a user on each server and added their public keys to the central server. I would like the cronjob to be run as root. But in the script su to the username that was created so it can scp with no password because of the public keys. This is what I tried to use but it does not work. Could you please suggest changes that should be made.


su joesomebody \
scp \
/usr/local/var/backup7pm/joesomebody-backups* \

Thank you,
Old 12-21-2006, 01:45 PM   #2
Senior Member
Registered: Sep 2005
Location: Russia
Distribution: NixOS (
Posts: 1,899

Rep: Reputation: 68
su user -c "command line"


su joesomebody -c " \
scp \
/usr/local/var/backup7pm/joesomebody-backups* \ \

should work in bash.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
sftp script via cronjob ?? OzTEXS Linux - Security 21 12-28-2006 03:38 PM
cronjob php script MrSako Linux - General 1 08-27-2006 07:30 PM
cronjob not working but script works dtra Linux - Newbie 4 02-28-2005 05:05 PM
cronjob help meeh Linux - General 1 03-26-2004 11:41 AM
Cronjob question jungsonn Linux - Newbie 3 03-22-2003 09:04 PM

All times are GMT -5. The time now is 02:56 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration