You are not logged in.
i found this command on this other website but i have been hesitant to try it because im araid it might screw everything up
usermod -l login-name old-name
http://www.cyberciti.biz/faq/howto-chan … r-name-id/
now my understanding is that i would also need to manually rename the home directory, but my question is what else will i need to do
so far all i can think of that i might need to change is home directory and sudoers file
i have searched abit on google for info about changing a users name but there seems to be a slight lack of documentation available on this subject
before i dive into this and possibly screw something up, does anybody here have any experience with changing users names?
if so what other problems might i run into?
do i need to change my uid also or can i keep the existing one?
Offline
man usermod
-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
name should probably be changed manually to reflect the new login
name.
Offline
'usermod', hunh? that's cool. i've done it by hand before, and all i *remember* changing were the entries in /etc/{passwd,group,sudoers,et al.}. the usermod man page has a *caveats* section you'll want to read. also, just to make sure you get everything, you might want to run 'grep -R username /' after the name change to find any files where the username has been hardcoded. but afaik, the uid is more important than the username for the base system, so definitely leave that in place.
good luck, and please report success or failure!
[23:00:16] dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32] dr_kludge | can you guess what i'd call it?
[23:01:16] dr_kludge | nosilla.
[23:01:32] dr_kludge | i really should be going to bed. i'm giggling madly about that.
Offline
Besides renaming $HOME,
chown Newyou:users $(find / -user Oldyou)
(I wonder if that would hit any limit to number of arguments or something? Maybe you should start with chown -R Newyou:users /home/Newyou, and then run it.
Anything that has paths in the file. grep -R Newyou / for an indication
Any binaries you built in your home dir with absolute paths might be affected (such as those that use a share directory.)
Offline
chown Newyou:users $(find / -user Oldyou)
(I wonder if that would hit any limit to number of arguments or something? Maybe you should start with chown -R Newyou:users /home/Newyou, and then run it.
i'm not sure about this. if the new user has the same uid as the old, this should be unneccessary, as ownership is determined by uid, not uname. the uname is mapped to the uid in /etc/passwd and the shadow files.
[23:00:16] dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32] dr_kludge | can you guess what i'd call it?
[23:01:16] dr_kludge | nosilla.
[23:01:32] dr_kludge | i really should be going to bed. i'm giggling madly about that.
Offline
Procyon wrote:chown Newyou:users $(find / -user Oldyou)
(I wonder if that would hit any limit to number of arguments or something? Maybe you should start with chown -R Newyou:users /home/Newyou, and then run it.
i'm not sure about this. if the new user has the same uid as the old, this should be unneccessary, as ownership is determined by uid, not uname. the uname is mapped to the uid in /etc/passwd and the shadow files.
I see. Does that mean if you change /etc/passwd and e.g. add a number after your name, it will show up the next time you ls -l?
Offline
kludge wrote:Procyon wrote:chown Newyou:users $(find / -user Oldyou)
(I wonder if that would hit any limit to number of arguments or something? Maybe you should start with chown -R Newyou:users /home/Newyou, and then run it.
i'm not sure about this. if the new user has the same uid as the old, this should be unneccessary, as ownership is determined by uid, not uname. the uname is mapped to the uid in /etc/passwd and the shadow files.
I see. Does that mean if you change /etc/passwd and e.g. add a number after your name, it will show up the next time you ls -l?
i didn't add a uid in /etc/passwd, i just changed the old uname to the new uname and left everything else the same. but yeah, after logging out and logging back in under the new uname (i might have had to reboot/rerun init... this was a long time ago), it showed up when i did ls -l.
i remember this because i remember being surprised by it.
[23:00:16] dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32] dr_kludge | can you guess what i'd call it?
[23:01:16] dr_kludge | nosilla.
[23:01:32] dr_kludge | i really should be going to bed. i'm giggling madly about that.
Offline
problem # 1
the user that i am changing is currently named arch and i want to name it to awesome (i am making seperate users for different WM's)
so i loged in as tj because
usermod will not allow you to change the name of a user who is logged
in. 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 is being changed. You must change the owner of any crontab
files manually. You must change the owner of any at jobs manually. You
must make any changes involving NIS on the NIS server.
i did
su -
(to become root)
i ran the command and changed the users name
usermod -l awesome arch
i then became awesome to test that it worked
su awesome
it worked so i exited back to tj
exit
i became root again
su -
i renamed /home/arch to /home/awesome
cd /home
mv arch awesome
it all seemed to work
i became awesome again
su awesome
i noticed that i get
bash-3.2$
instead of
[awesome@myhost ~]$
if i do cd ~ it says
bash: cd: /home/arch: No such file or directory
so basically my question now is..
what file do i need to edit to change the location of the home directory that the user is using?
Offline
if i do cd ~ it says
bash: cd: /home/arch: No such file or directory
so basically my question now is..
what file do i need to edit to change the location of the home directory that the user is using?
each user's home directory path is defined in one of the fields in that user's line in /etc/passwd. 'man 5 passwd' for the details.
Last edited by kludge (2009-01-26 21:26:02)
[23:00:16] dr_kludge | i want to invent an olfactory human-computer interface, integrate it into the web standards, then produce my own forked browser.
[23:00:32] dr_kludge | can you guess what i'd call it?
[23:01:16] dr_kludge | nosilla.
[23:01:32] dr_kludge | i really should be going to bed. i'm giggling madly about that.
Offline
I don't know how everyone else has ever done this, but I just logged in as root, deleted my old login, switched ownerships of all files and changed name of the ~/ dir to new user login and then recreated the user specifying the ~/ directory (of the old user with the new name) upon creation of the newuser.
I didn't have any trouble with this method. But you are using root so it can be dangerous I suppose.
Last edited by jacko (2009-01-26 21:39:19)
Offline
each user's home directory path is defined in one of the fields in that user's line in /etc/passwd. 'man 5 passwd' for the details.
thanks, it works
all seems to be working as normal now
thank you all for your help
Offline