Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 4270  / 1 Year ago, wed, november 23, 2022, 6:09:07

I'm new to svn and ssh. I'm trying to do svn update of 5 repositories in my local system every 3 hours on crontab.
So, to achieve this I have setup ssh passwordless login using the below steps:

1. ssh-keygen

2. ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

3. I did ssh [email protected]
Till here it works fine for me. I'm able to login without password.
But, when I try to do sudo svn update on the 5 repositories, it is propmpting for password.
How to make svn update without password. Is there any way that I can do update of the repositories every 3 hours on cron.
I referred to this, but could not get it.

I'm using



`Ubuntu version : Ubuntu 13.04`         
OpenSSH_6.1p1 Debian-4, OpenSSL 1.0.1c 10 May 2012

More From » 13.04

 Answers
1

The problem is that since you use sudo, the svn update command is executed as root, so the ~/.ssh directory of your normal user is not taken into account.



If you have to do the svn update as root, then you should also perform the steps 1 and 2 that you described as root, i.e., with sudo. But only do this id you are very aware of what you are doing.



If it is possible for you to do all those svn updates as a normal user, that would be a much better way. In that case, simply remove the sudo and only execute the command svn update as a cronjob. Additionally, you will also have to run the cronjob as a normal user. Refer to this answer here to learn how to execute cronjobs as a normal user:



https://superuser.com/questions/170866/how-to-run-a-cron-job-as-a-specific-user



In you case, you would probably want something like this in /etc/crontab:



 00 */3   * * *   yourusername   cd /some/path/ && svn update


Replace yourusername with the username of the user that generated the SSH keypair and copied the public key to [email protected], and /some/path/ with the path to your local copy of the svn repo you want to check out.


[#27951] Thursday, November 24, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
eatack

Total Points: 245
Total Questions: 120
Total Answers: 113

Location: Estonia
Member since Wed, Jun 8, 2022
2 Years ago
;