Page MenuHomePhabricator

move user home to persistent storage


We need to move or bind /home
to persistent storage (e.g. /config/home)


Difficulty level
Unknown (require assessment)
Why the issue appeared?
Will be filled on close
syncer created this task.Jul 11 2018, 7:51 PM
syncer assigned this task to UnicronNL.
syncer triaged this task as Normal priority.Jul 12 2018, 8:52 AM

If someone could point me to the relevant code files / documentation, I can give it a look.
If it is a simple thing to do I may even be able to create a PR.

I would start to look into /opt/vyatta/sbin/install-image*, those are the 'install image' scripts, you can see the mounts there since the OS part is a squashfs mount.

Thanks @hagbard


is it. I can surely extend it quick and dirty to have something working which can then be improved and beautified as needed.

Thanks @c-po. I'm not sure though - how does "user creation" matter in that context? I had the impression that preserving home/user will be mostly a matter of adding a few lines of code to similar to the /etc/ssh block starting at line 240. Am I wrong?

The below code does work if inserted at line 254. It does however mess with the ownership of the home dir it's all owned by vyos afterwards even though cp -p i used, resulting ssh key based authn not working anymore until fixing ownership.

  1. Would someone know why this happened and how to fix it?
  2. Other question I was asking myself - SSH authorized_keys seem to be copied over already - where does this happen?
if [ -d /home ]; then
  while [ -z "$resp" ]; do
    echo 'Would you like to save /home/* from your '
    echo -n 'current configuration? (Make sure you have enough free space!) (Yes/No) [Yes]: '
    resp=$(get_response "Yes" "Yes No Y N")
    if [ "$resp" == 'yes' ] || [ "$resp" == 'y' ]; then
      echo 'Copying /home/*...'
      mkdir -p $ndir
      cp -rp /home/* $ndir

I never had a look into that, however I found something interesting., check out save_old_keys() at line 433.
The script you are looking into is, when vyos is already installed.

Thank you @hagbard. This copies unfortunately only the ssh host keys. Interstingly this also happens in install-image-existing and is likely duplicate code ?

Guess I have to clone the repos and do a full text search to find out where and how ssh ~/.ssh/authorized_keys gets copied over.

dmbaturin edited projects, added VyOS 1.3.x; removed VyOS 1.2.x.Sep 2 2018, 9:47 PM