BackupPC-users

Re: [BackupPC-users] ssh-keygen on Ubuntu 14.04

2014-11-12 19:16:03
Subject: Re: [BackupPC-users] ssh-keygen on Ubuntu 14.04
From: Tom Fallon <tom.r.fallon AT gmail DOT com>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Thu, 13 Nov 2014 00:13:40 +0000
Hi all and thanks for the prompt and helpful answers.

I installed this via normal Ubuntu packages which I believe installs the 
backuppc user as part of the install.

Les' idea of mounting first to /var/lib/backuppc and *then* installing 
backuppc makes a lot of sense.

So I've unmounted /mnt/raid, done an apt-get purge backuppc, deleted the 
backuppc user and the /var/lib/backuppc directory.

I've created a new empty /var/lib/backuppc directory and mounted this to 
/dev/md0 which is my Raid1 setup.

And then edited the /etc/fstab to read as below to retain mount on reboot:

#mount raid set
/dev/md0      /var/lib/backuppc     ext4    defaults    1 2

And *then* reinstalled backuppc via apt-get install backuppc. The 
backuppc user now shows in /etc/passwd as below which looks much healthier:

backuppc:x:106:115:BackupPC,,,:/var/lib/backuppc:/bin/sh

Now ssh-keygen seems to work as expected.

$ su - backuppc
$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/var/lib/backuppc/.ssh/id_rsa):
Created directory '/var/lib/backuppc/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/lib/backuppc/.ssh/id_rsa.
Your public key has been saved in /var/lib/backuppc/.ssh/id_rsa.pub.

Lastly running ssh-copy-id -i /var/lib/backuppc/.ssh/id_rsa.pub 
root@remote-mac-server worked fine too so the issue must have all been 
to do with the funky backuppc user install on the server.

Thanks again everyone, this mailing list rocks.

Cheers, Tom


On 12/11/14 23:16, Mauro Condarelli wrote:
> User backuppc, by default, has the home directory in the same place 
> where the files will be saved, or, if you prefer, files get saved into 
> user backuppc HOME.
>
> You relocated the save space  (how? if You installed from source it's 
> ok, but otherwise there are a number of problems there), but I guess 
> you forgot to relocate the pointer to the home directory in /etc/passwd.
>
> Symptoms say home-dir field in passwd holds an invalid value.
> backuppc should have a valid home-dir, even if is prevented from 
> logging directly setting shell to something invalid (e.g. /bin/false).
>
> Fix that and then you'll be able to proceed with keygen
>
> Nella citazione in data mercoledì 12 novembre 2014 23:46:55, Tom 
> Fallon ha scritto:
>> Hi all
>>
>> on an Ubuntu 14.04 server I've installed backuppc afresh, moved
>> /var/lib/backuppc to /mnt/raid (a raid1 soft raid setup) and am in the
>> process of configuring the last steps.
>>
>> Web access is fine and I can add hosts etc but I've reached a stumbling
>> block with the ssh-key setup. Following the backuppc install notes on
>> the site I do:
>>
>> su - backuppc
>>
>> and would then expect to follow the prompts after doing ssh-keygen
>> (which I've done successfully on another box, albeit on 12.04). However,
>> I hit a snag with this:
>>
>> No directory, logging in with HOME=/
>>
>> Permissions are such that backuppc cannot create a home directory for
>> itself. So when I try and run ssh-keygen I get permission error if I try
>> and save to default location from the command.
>>
>> Enter file in which to save the key (/home/backuppc/.ssh/id_rsa):
>> Could not create directory '/home/backuppc/.ssh': No such file or 
>> directory
>> Enter passphrase (empty for no passphrase):
>>
>> I've therefore tried to save to /var/lib/backuppc/.ssh/id_rsa as I know
>> backuppc is the owner of /var/lib/backuppc.... but get this error:
>>
>> open /var/lib/backuppc/.ssh/id_rsa failed: No such file or directory.
>>
>> So I took the plunge and created /var/lib/backuppc/.ssh/ and created the
>> public key there.
>>
>> And then run ssh-keygen -t rsa which completes with no error and an ls
>> /var/lib/backuppc/.ssh/ shows the 2 files id_rsa an id.rsa.pub there
>>
>> If it then try and copy the file from backuppc to my target client with
>>
>> $ ssh-copy-id -i /var/lib/backuppc/.ssh/id_rsa.pub root@remoteserver
>>
>> I get this (this is sending to a Mac 10.5 server in case thats relevant)
>>
>> mktemp: failed to create file via template
>> ‘//.ssh/ssh-copy-id_id.XXXXXXXXXX’: No such file or directory
>> mktemp failed
>>
>> I suspect I'm making this more complicated and difficult than it really
>> needs to be. And perhaps a simple tweak right at the outset to sort my
>> lack of home directory on backuppc user or similar may be the solution.
>> Or perhaps I need to enable root on the server?
>>
>> I've been banging my head against this metaphorical wall for some time
>> now so anyone who has any suggestions please let me know.
>>
>> best.
>>
>>
>>


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/
<Prev in Thread] Current Thread [Next in Thread>