Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then 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 there a way in Linux that I can change a user name and keep the same password and permissions for that user?
It's a generic user I created for FTP and I would like to change the user name but keep the same password. I also don't want to lose the files folders and permissions.
I did a search here and only found someone wanting to change their forum user name.
not sure about the absolute answer to your question, but you could always create another user, then move the files over to the new user and change all the permissions on everything using
Code:
# chown user:group <files>
that would get you where you want to go eventually. You'd then have to delete the old user.
Haven't tried this, but it looks to be theoretically possible.
Have a look at the man pages for the useradd program. You can specify a UID and GID as options. That may mean you will need to first remove the existing user. But the files he owns should still retain the same UID/GID.
Then just change the password to what you're using now after you have added him.
Warning: Test this first with a user and files you don't care about! (i.e. create a test case.)
stricom is still part of the peostri group (many Linux distros put each user in their own group by default) so you need to change the name of the peostri group like this
You could use vipw to change the username in the passwd and shadow files, then rename the home directory to the new username. If you don't change the UID in the files, then the user permissions should "automagically" change.
Originally posted by tkedwards stricom is still part of the peostri group (many Linux distros put each user in their own group by default) so you need to change the name of the peostri group like this
Code:
groupmod -n stricom peostri
That worked!
Code:
stricom:/home/carlos/music# groupmod -n stricom peostri
stricom:/home/carlos/music# su stricom
stricom@stricom:/home/carlos/music$ cd /home/stricom/
stricom@stricom:~$ ls -lh
total 16K
drwxr-xr-x 2 stricom stricom 4.0K 2005-10-26 12:35 chris
drwxr-xr-x 2 stricom stricom 4.0K 2005-10-14 16:42 derek
-rw-r--r-- 1 root root 990 2005-10-26 07:25 readme.txt
drwxr-xr-x 2 stricom stricom 4.0K 2005-10-14 16:42 tim
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.