Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Is it possible to change the usernames on Linux? I have a Linux box with 10 users (username = firstname). As the number of users are growing I want to change the username convention to include the last names also (username = firstname_lastname). So is it possible to change the existing usernames without changing their profile?
Some distros create a group with the same name as the user, so user john gets the group john.
'usermod -l john_smith john' will change the username from john to john_smith, but not his group. he will be john_smith in group john.
use 'groupmod -n john_smith john' to change the groupname accordingly to get the group changed. Again, IF your distro does such.
indeed, the home directory...
using 'usermod -l john_smith john' does change the username, but not his home directory!..
use 'usermod -l john_smith -d /home/john_smith john' instead, to make the homedir change as well..
Don't forget to rename his homedirectory with 'mv /home/john /home/john_smith'.
Finally: the mail spool file.. I don't know if distros fix that automagically. User john has his own mail spool file, in most cases '/var/spool/mail/john'. You'll have to rename the file to fit the new username with 'mv /var/spool/mail/john /var/spool/mail/john_smith'.
<disclaimer>
Oh, I based the given commands on my distro, Fedora. I can't tell how your version would react. Mostly they're alike, just to be sure: 'man usermod', 'man groupmod' to verify correctness.
</disclaimer>
This would fix a lot.
PS using samba? don't forget to change the user over there as well.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.