Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bellerbrock/bbf31474b073ccd4b293 to your computer and use it in GitHub Desktop.
Save bellerbrock/bbf31474b073ccd4b293 to your computer and use it in GitHub Desktop.
1. Login to VM as user who will be changed
1. use command 'id' to list current user's ids. Writedown current(old) UID and GID
2. determine what your new username's ids will be. If you already have an account in the sgn network, ssh into solanine and run 'cat /etc/passwd' to see what you systemwide ids are
3. change password with command 'passwd'
4. 'sudo su' to become superuser
4.5 for the following commands, it may be necessary to first stop all processes associated with the user to be changed, by running 'killall --user <OLDUSERNAME>'
5. 'usermod -l <NEWUSERNAME> -m -d <PATH/TO/NEW/HOMEDIR> <OLDUSERNAME>' to rename username and homedir
6. 'groupmod -n <NEWUSERNAME> <OLDUSERNAME>' to rename group
7. 'usermod -u <NEWUID> <USERNAME>' to change UID
8. 'groupmod -g <NEWGID> <GROUPNAME>' to change GID
9. 'find / -user <OLDUID> -exec chown -h <NEWUID> {} \;' to find all files and folders and update UID
10. 'find / -group <OLDGID> -exec chgrp -h <NEWGID> {} \;' to find all files and folders and update GID
11. 'usermod -g <NEWGID> <NEWUSERNAME>'
12. exit
13. as normal user, edit .bashrc in home dir and change hardcoded paths. You can use emacs and use replace-string
14. 'source .bashrc' to reload source and have system recognize changes
15. edit hardcoded paths in sgn_local.conf
16. sudo rm cxgn/sgn/static/documents/tempfiles . This symlink will be broken, so remove it and it will be rebuilt automatically whne server is restarted
17. login screen will still list old username. You can go to system settings / user accounts using the GUI and change this.
@bellerbrock
Copy link
Author

Alternative to 17:
Change the full name to your name for Gnome login sessions
chfn -f "Your Name"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment