Moving To New Machine

When you get a new machine, you will generally want to minimise the amount of work it takes to get things back up and running.

Leave Old Machine Running and Set up SSHD

If possible, it's nice to be able to copy stuff from your old machine over SSH

To do this, you will need to make sure sshd is installed and running

1
2
3
su
dnf -y install openssh-server
systemct enable sshd

Then on your new machine, its advisable to set up an .ssh/config entry:

1
2
3
4
5
echo "

   HostName old-machine
   Host 192.168.xxx.xxx
" >> ~/.ssh/config
And copy your ssh key

1
ssh-copy-id old-machine

Copying Containers

If you would like to copy all of your installed containers from your old machine to your new one, you can do it like this

SSH Config

First make sure you have set up your ssh config and also copied this into /root/.ssh/config

Snippets Library

You need to have the snippets library set up

Danger

Make sure you execute script below as root, to avoid interrupting password prompts.

1
2
3
4
5
6
7
for c in $(ssh old-machine ls /var/lib/lxc); 
do 
    echo $c; 
    sudo /opt/Projects/snippets-edmondscommerce/Cluster/shellscripts/desktop/lxc/cloneFromOtherDesktopMachine.bash \
        $c \
        old-machine; 
done

Note

You need to change old-machine in the above script, twice, to whatever you set as your ssh-config entry

Clone only specific containers

1
2
3
4
5
6
7
for c in container-name1 container-name2 container-name3; 
do 
    echo $c; 
    sudo /opt/Projects/snippets-edmondscommerce/Cluster/shellscripts/desktop/lxc/cloneFromOtherDesktopMachine.bash \
        $c \
        old-machine; 
done

Rename User On New Machine

Assuming you are moving to a new machine with a user ec then we need to rename this. In this we assume your name is somename

First, Log Out as ec and Log In as Root

You need to totally stop processes running as ec. The best way to do this is to log out completely. Then at the login screen you can press the link to say "not listed" and then you can log into Gnome Shell as root

Next, Run Commands

Open a terminal and run the following commands

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# change ec name to somename
usermod -l somename ec

#rename the home directory 
mv /home/ec/ /home/somename

#replace somename user home directory from /home/ec/ to /home/somename
vim /etc/passwd

#rename ec group to somename
groupmod -n somename ec

#finally, confirm that guid and id is still 1000 as it was previously with ec user
su somename
id

Now you can log out of your root Gnome Shell session and log in as normal. The username on the login screen is still wrong, we will fix that next

Simply log in, then in settings->users you can change the name there