Skip to content

Instantly share code, notes, and snippets.

@carlohamalainen
Created September 28, 2024 08:02
Show Gist options
  • Save carlohamalainen/726911a7292483349ec368f3990b4512 to your computer and use it in GitHub Desktop.
Save carlohamalainen/726911a7292483349ec368f3990b4512 to your computer and use it in GitHub Desktop.
Migrate olduser to newuser; test discussion with ChatGPT o1-preview
# Stop systemd services - RUN AS olduser
systemctl --user stop job1.service
systemctl --user stop job2.service
systemctl --user stop job3.service
# Disable systemd services - RUN AS olduser
systemctl --user disable job1.service
systemctl --user disable job2.service
systemctl --user disable job3.service
# Reload systemd - RUN AS olduser
systemctl --user daemon-reload
# Migrate home directory - RUN AS ROOT USER
rsync -a --exclude='.ssh/' /home/olduser/ /home/newuser/
chown -R newuser:ourgroup /home/newuser
# Migrate application directory - RUN AS ROOT USER
chown -R newuser:ourgroup /application
# Set Systemd Linger for newuser - RUN AS newuser
loginctl enable-linger newuser
systemctl --user daemon-reload
# Enable systemd services - RUN AS newuser
systemctl --user enable job1.service
systemctl --user enable job2.service
systemctl --user enable job3.service
systemctl --user daemon-reload
# Start systemd services - RUN AS newuser
systemctl --user start job1.service
systemctl --user start job2.service
systemctl --user start job3.service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment