Announcement

Collapse
No announcement yet.

Is there a simple way to change my user name?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Is there a simple way to change my user name?

    I am the only user of my Kubuntu 13.04, so have admin access. Is there a GUI-based way to change my user name? Or a simple CL command?

    I've had a look at the User Management Application in System Settings, but there's no obvious step, and I'm loath to start meddling in the unknown. Done too much damage that way, in the past....

    Cheers

    #2
    Look at the file /etc/passwd

    If I'm not mistaken, you can edit it (as root) and change your display or "real" names.

    If it were me, I''d log out of the GUI, switch to a terminal via CRTL-ALT-F1, log in, edit the file using sudo nano /etc/passwd, save, and then restart your display manager via sudo stop lightdm && sudo start lightdm or just reboot.

    Fair warning: I've not tried this myself but I have done similar edits (changing home location, group names, etc.) without problems.

    Please Read Me

    Comment


      #3
      I think the proper command to do this is chfn, but it won't allow a name change by default unless you're root. You could try sudo chfn <USERNAME> and see if it allows you to make the edit that way.

      EDIT: It appears chfn will allow change to full name, not user name,

      Please Read Me

      Comment


        #4
        I just did this to a user acct. last night ,,,,,, with the system settings user management.
        click the user (you) in the user management window to select it , click modify , on the details tab just change the log in name and click apply ,,,,the login name will change but all the rest (/home/name) will not ,,,

        VINNY

        EDDIT: I also changed the password for the account as well
        Last edited by vinnywright; Sep 01, 2013, 09:45 AM.
        i7 4core HT 8MB L3 2.9GHz
        16GB RAM
        Nvidia GTX 860M 4GB RAM 1152 cuda cores

        Comment


          #5
          See How to Change your Username in Ubuntu 11.10 (Oneiric Ocelot). Yes, it's for 11.10, but the method is still valid. Read it carefully, and if you don't understand, ask questions.
          Windows no longer obstructs my view.
          Using Kubuntu Linux since March 23, 2007.
          "It is a capital mistake to theorize before one has data." - Sherlock Holmes

          Comment


            #6
            Originally posted by Snowhog View Post
            See How to Change your Username in Ubuntu 11.10 (Oneiric Ocelot). Yes, it's for 11.10, but the method is still valid. Read it carefully, and if you don't understand, ask questions.
            That seems like a lot of steps vs. just editing the passwd file. Is there any benefit to doing it that way?

            Please Read Me

            Comment


              #7
              Actually, it looks like usermod command can do this without all the shenanigans.

              usermod -l <new-name> <old-name>

              I'd do it logged out of the GUI and using sudo -i

              Please Read Me

              Comment


                #8
                Originally posted by oshunluvr View Post
                usermod -l <new-name> <old-name>
                The manpage shows that:
                -l, --login NEW_LOGIN
                The name of the user will be changed from LOGIN to NEW_LOGIN. Nothing else is changed. In particular, the user's home directory or mail spool should probably be renamed manually to reflect the new login name.
                One would need to use the -d (--home) and -m (--move-home) options along with -l option:

                usermod -ldm <new-name> <old-name>

                -d, --home HOME_DIR
                The user's new login directory.

                If the -m option is given, the contents of the current home directory will be moved to the new home directory, which is created if it does not already exist.


                -m, --move-home
                Move the content of the user's home directory to the new location.

                This option is only valid in combination with the -d (or --home) option.

                usermod will try to adapt the ownership of the files and to copy the modes, ACL and extended attributes, but manual changes might be needed afterwards.
                Windows no longer obstructs my view.
                Using Kubuntu Linux since March 23, 2007.
                "It is a capital mistake to theorize before one has data." - Sherlock Holmes

                Comment


                  #9
                  Originally posted by Snowhog View Post
                  usermod -ldm <new-name> <old-name>
                  Don't the -d and -l options need $OPTARGs (as in you can't just stack them together)?:
                  usermod -l <newname> -d /home/<newname> -m <oldname>

                  You'll likely still have to fix primary group for the user as well ( 'groupmod -n newname oldname' ?), and possibly other issues such as crontab entries for the user (if you have them) etc., so this is by no means a trivial change (which probably explains why there is no simple way to do it), like changing user's full name.
                  Last edited by kubicle; Sep 01, 2013, 11:18 AM.

                  Comment


                    #10
                    Well, I disagree to a point. There's no requirement to have your user home directory the same name as your log in name. Nor is there any requirement to have an unique group name that's the same as your log in name, or to even have a unique group at all. The OP only asked how to change the log in name. Admittedly, these are fairly common conventions and are the default for Ubuntu variants, but not requirements. I'm am trying to remember which one (Sabayon maybe?), but I have used a distro in the past that put all users in the "user" group as primary. I rather liked that because it made file sharing easier. Obviously, it had different default umask settings as well.

                    I used to convert my desktop to this convention (no unique primary group) but now anyone else in the house rarely uses my computer except for me and file sharing is done via my server so I long longer bother.

                    ADDED: Actually, now that I think about it, it would be cool to have your primary group different than your log in because file listing would be more interesting. If your log in is "bob" and your primary group is "jones" your ls output would show "bob jones" as the file owner. Cool!
                    Last edited by oshunluvr; Sep 02, 2013, 09:05 AM.

                    Please Read Me

                    Comment


                      #11
                      Thanks for the comments, guys. Sorry I've been slow to reply.

                      I'm reluctant to use the CL commands you've suggested - they're beyond my comfort zone.

                      The system settings User Management tool seems easiest to use. Suppose I use it to change my log-in name AND my home directory path (so they match), AND then manually rename my home directory (to match the new home directory path)?

                      Will it work? I'm nervous about messing up permissions and groups.

                      Thanks

                      Comment

                      Working...
                      X