When trying to change username, terminal tells me user is currently used by process

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
10
down vote

favorite












I am trying to change my username, as per advice here however after running the following command:



CurrentName@HostName ~ $ sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName


Terminal responds with:



CurrentName@HostName ~ $ usermod: user CurrentName is currently used by process 2491


And the username stays the same. Does anybody know how I could fix this and change my username after all?










share|improve this question



























    up vote
    10
    down vote

    favorite












    I am trying to change my username, as per advice here however after running the following command:



    CurrentName@HostName ~ $ sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName


    Terminal responds with:



    CurrentName@HostName ~ $ usermod: user CurrentName is currently used by process 2491


    And the username stays the same. Does anybody know how I could fix this and change my username after all?










    share|improve this question

























      up vote
      10
      down vote

      favorite









      up vote
      10
      down vote

      favorite











      I am trying to change my username, as per advice here however after running the following command:



      CurrentName@HostName ~ $ sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName


      Terminal responds with:



      CurrentName@HostName ~ $ usermod: user CurrentName is currently used by process 2491


      And the username stays the same. Does anybody know how I could fix this and change my username after all?










      share|improve this question















      I am trying to change my username, as per advice here however after running the following command:



      CurrentName@HostName ~ $ sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName


      Terminal responds with:



      CurrentName@HostName ~ $ usermod: user CurrentName is currently used by process 2491


      And the username stays the same. Does anybody know how I could fix this and change my username after all?







      linux ubuntu linux-mint users






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Oct 3 '15 at 2:27

























      asked Oct 3 '15 at 0:38









      Paradox

      2841320




      2841320




















          4 Answers
          4






          active

          oldest

          votes

















          up vote
          8
          down vote



          accepted










          To quote man usermod :



          CAVEATS
          You must make certain that the named user is not executing any
          processes when this command is being executed
          if the user's numerical user ID, the user's name, or the user's home
          directory is being changed. usermod
          checks this on Linux, but only check if the user is logged in
          according to utmp on other architectures.


          So, you need to make sure the user you're renaming is not logged in.



          Also, I note you're not running this as root. Either run it as root, or run with "sudo usermod".






          share|improve this answer




















          • if you can't kill the process without it restarting, combine the command e.g. kill -9 23162 && sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName
            – Richard Frank
            Apr 19 '17 at 11:45











          • The program usermod seems to be broken by design. If the user management is done in a LDAP server, changing a user attribute is always possible and does not depend on the running system. I am using Ansible which uses usermod and the hole system is unreliable, because changes are blocked by users logged in.
            – ceving
            Aug 2 '17 at 14:17

















          up vote
          1
          down vote













          I think that you should run the command with another user. Login with root, or other user, and try again. If you are in the x window with the user that you want to change, sounds logical that the commands fails.






          share|improve this answer



























            up vote
            0
            down vote













            I have the same issue using usermod, it fixed using the -m parameter, that move the content of the home directory to a new localization. Use this option in combination with -d (modify the user main directory, where there user ).



            I suggest to see the man usermod command






            share|improve this answer



























              up vote
              0
              down vote













              This is mainly a problem with Ubutu where you don't have a root account to login from the first place. So this create a contradiction: I am a user in the sudoer group. I cannot change my own uid.



              Not sure this is the best solution. I first create a fake account foo, add this to the sudo list. Then I login to the foo account and execute usermod -g MYOWNGID mylogin






              share|improve this answer




















                Your Answer








                StackExchange.ready(function()
                var channelOptions =
                tags: "".split(" "),
                id: "106"
                ;
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function()
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled)
                StackExchange.using("snippets", function()
                createEditor();
                );

                else
                createEditor();

                );

                function createEditor()
                StackExchange.prepareEditor(
                heartbeatType: 'answer',
                convertImagesToLinks: false,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: null,
                bindNavPrevention: true,
                postfix: "",
                imageUploader:
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                ,
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                );



                );













                 

                draft saved


                draft discarded


















                StackExchange.ready(
                function ()
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f233614%2fwhen-trying-to-change-username-terminal-tells-me-user-is-currently-used-by-proc%23new-answer', 'question_page');

                );

                Post as a guest















                Required, but never shown

























                4 Answers
                4






                active

                oldest

                votes








                4 Answers
                4






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes








                up vote
                8
                down vote



                accepted










                To quote man usermod :



                CAVEATS
                You must make certain that the named user is not executing any
                processes when this command is being executed
                if the user's numerical user ID, the user's name, or the user's home
                directory is being changed. usermod
                checks this on Linux, but only check if the user is logged in
                according to utmp on other architectures.


                So, you need to make sure the user you're renaming is not logged in.



                Also, I note you're not running this as root. Either run it as root, or run with "sudo usermod".






                share|improve this answer




















                • if you can't kill the process without it restarting, combine the command e.g. kill -9 23162 && sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName
                  – Richard Frank
                  Apr 19 '17 at 11:45











                • The program usermod seems to be broken by design. If the user management is done in a LDAP server, changing a user attribute is always possible and does not depend on the running system. I am using Ansible which uses usermod and the hole system is unreliable, because changes are blocked by users logged in.
                  – ceving
                  Aug 2 '17 at 14:17














                up vote
                8
                down vote



                accepted










                To quote man usermod :



                CAVEATS
                You must make certain that the named user is not executing any
                processes when this command is being executed
                if the user's numerical user ID, the user's name, or the user's home
                directory is being changed. usermod
                checks this on Linux, but only check if the user is logged in
                according to utmp on other architectures.


                So, you need to make sure the user you're renaming is not logged in.



                Also, I note you're not running this as root. Either run it as root, or run with "sudo usermod".






                share|improve this answer




















                • if you can't kill the process without it restarting, combine the command e.g. kill -9 23162 && sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName
                  – Richard Frank
                  Apr 19 '17 at 11:45











                • The program usermod seems to be broken by design. If the user management is done in a LDAP server, changing a user attribute is always possible and does not depend on the running system. I am using Ansible which uses usermod and the hole system is unreliable, because changes are blocked by users logged in.
                  – ceving
                  Aug 2 '17 at 14:17












                up vote
                8
                down vote



                accepted







                up vote
                8
                down vote



                accepted






                To quote man usermod :



                CAVEATS
                You must make certain that the named user is not executing any
                processes when this command is being executed
                if the user's numerical user ID, the user's name, or the user's home
                directory is being changed. usermod
                checks this on Linux, but only check if the user is logged in
                according to utmp on other architectures.


                So, you need to make sure the user you're renaming is not logged in.



                Also, I note you're not running this as root. Either run it as root, or run with "sudo usermod".






                share|improve this answer












                To quote man usermod :



                CAVEATS
                You must make certain that the named user is not executing any
                processes when this command is being executed
                if the user's numerical user ID, the user's name, or the user's home
                directory is being changed. usermod
                checks this on Linux, but only check if the user is logged in
                according to utmp on other architectures.


                So, you need to make sure the user you're renaming is not logged in.



                Also, I note you're not running this as root. Either run it as root, or run with "sudo usermod".







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Oct 3 '15 at 1:24









                seumasmac

                1,373710




                1,373710











                • if you can't kill the process without it restarting, combine the command e.g. kill -9 23162 && sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName
                  – Richard Frank
                  Apr 19 '17 at 11:45











                • The program usermod seems to be broken by design. If the user management is done in a LDAP server, changing a user attribute is always possible and does not depend on the running system. I am using Ansible which uses usermod and the hole system is unreliable, because changes are blocked by users logged in.
                  – ceving
                  Aug 2 '17 at 14:17
















                • if you can't kill the process without it restarting, combine the command e.g. kill -9 23162 && sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName
                  – Richard Frank
                  Apr 19 '17 at 11:45











                • The program usermod seems to be broken by design. If the user management is done in a LDAP server, changing a user attribute is always possible and does not depend on the running system. I am using Ansible which uses usermod and the hole system is unreliable, because changes are blocked by users logged in.
                  – ceving
                  Aug 2 '17 at 14:17















                if you can't kill the process without it restarting, combine the command e.g. kill -9 23162 && sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName
                – Richard Frank
                Apr 19 '17 at 11:45





                if you can't kill the process without it restarting, combine the command e.g. kill -9 23162 && sudo usermod -l TheNameIWantToChange -d /home/TheNameIWantToChange -m CurrentName
                – Richard Frank
                Apr 19 '17 at 11:45













                The program usermod seems to be broken by design. If the user management is done in a LDAP server, changing a user attribute is always possible and does not depend on the running system. I am using Ansible which uses usermod and the hole system is unreliable, because changes are blocked by users logged in.
                – ceving
                Aug 2 '17 at 14:17




                The program usermod seems to be broken by design. If the user management is done in a LDAP server, changing a user attribute is always possible and does not depend on the running system. I am using Ansible which uses usermod and the hole system is unreliable, because changes are blocked by users logged in.
                – ceving
                Aug 2 '17 at 14:17












                up vote
                1
                down vote













                I think that you should run the command with another user. Login with root, or other user, and try again. If you are in the x window with the user that you want to change, sounds logical that the commands fails.






                share|improve this answer
























                  up vote
                  1
                  down vote













                  I think that you should run the command with another user. Login with root, or other user, and try again. If you are in the x window with the user that you want to change, sounds logical that the commands fails.






                  share|improve this answer






















                    up vote
                    1
                    down vote










                    up vote
                    1
                    down vote









                    I think that you should run the command with another user. Login with root, or other user, and try again. If you are in the x window with the user that you want to change, sounds logical that the commands fails.






                    share|improve this answer












                    I think that you should run the command with another user. Login with root, or other user, and try again. If you are in the x window with the user that you want to change, sounds logical that the commands fails.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Oct 3 '15 at 1:23









                    krivos

                    163




                    163




















                        up vote
                        0
                        down vote













                        I have the same issue using usermod, it fixed using the -m parameter, that move the content of the home directory to a new localization. Use this option in combination with -d (modify the user main directory, where there user ).



                        I suggest to see the man usermod command






                        share|improve this answer
























                          up vote
                          0
                          down vote













                          I have the same issue using usermod, it fixed using the -m parameter, that move the content of the home directory to a new localization. Use this option in combination with -d (modify the user main directory, where there user ).



                          I suggest to see the man usermod command






                          share|improve this answer






















                            up vote
                            0
                            down vote










                            up vote
                            0
                            down vote









                            I have the same issue using usermod, it fixed using the -m parameter, that move the content of the home directory to a new localization. Use this option in combination with -d (modify the user main directory, where there user ).



                            I suggest to see the man usermod command






                            share|improve this answer












                            I have the same issue using usermod, it fixed using the -m parameter, that move the content of the home directory to a new localization. Use this option in combination with -d (modify the user main directory, where there user ).



                            I suggest to see the man usermod command







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Feb 3 at 6:40









                            Guillermo Porras Arias

                            1




                            1




















                                up vote
                                0
                                down vote













                                This is mainly a problem with Ubutu where you don't have a root account to login from the first place. So this create a contradiction: I am a user in the sudoer group. I cannot change my own uid.



                                Not sure this is the best solution. I first create a fake account foo, add this to the sudo list. Then I login to the foo account and execute usermod -g MYOWNGID mylogin






                                share|improve this answer
























                                  up vote
                                  0
                                  down vote













                                  This is mainly a problem with Ubutu where you don't have a root account to login from the first place. So this create a contradiction: I am a user in the sudoer group. I cannot change my own uid.



                                  Not sure this is the best solution. I first create a fake account foo, add this to the sudo list. Then I login to the foo account and execute usermod -g MYOWNGID mylogin






                                  share|improve this answer






















                                    up vote
                                    0
                                    down vote










                                    up vote
                                    0
                                    down vote









                                    This is mainly a problem with Ubutu where you don't have a root account to login from the first place. So this create a contradiction: I am a user in the sudoer group. I cannot change my own uid.



                                    Not sure this is the best solution. I first create a fake account foo, add this to the sudo list. Then I login to the foo account and execute usermod -g MYOWNGID mylogin






                                    share|improve this answer












                                    This is mainly a problem with Ubutu where you don't have a root account to login from the first place. So this create a contradiction: I am a user in the sudoer group. I cannot change my own uid.



                                    Not sure this is the best solution. I first create a fake account foo, add this to the sudo list. Then I login to the foo account and execute usermod -g MYOWNGID mylogin







                                    share|improve this answer












                                    share|improve this answer



                                    share|improve this answer










                                    answered Nov 20 at 5:32









                                    Kemin Zhou

                                    19115




                                    19115



























                                         

                                        draft saved


                                        draft discarded















































                                         


                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function ()
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f233614%2fwhen-trying-to-change-username-terminal-tells-me-user-is-currently-used-by-proc%23new-answer', 'question_page');

                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown






                                        Popular posts from this blog

                                        How to check contact read email or not when send email to Individual?

                                        Bahrain

                                        Postfix configuration issue with fips on centos 7; mailgun relay