Renaming a user?
Any easy way to rename a linux user in the console?
|
edit the /etc/passwd, /wtc/group and /etc/shadown group. After that, change the owner of the homedirectory to the new user.
|
why not just create a new user then change permissions on the home dir? it's easier than editing the files
# useradd -m -s /bin/bash newuser # passwd newuser mv -fr /home/olduser /home/newuser chown -R newuser /home/newuser |
saman007uk and bosewicht,
Unfortunately, this doesn't work, although, intuitively, it feels as though it should. The problem is that many of the configuration files (~/dotSomething) contain references to olduser. They do not work when simply chown'd. For example, see the output of grep -r /home/olduser/.* I suppose you could write some sort of script with sed to change all the references to olduser to newuser within these files, but then there are also some files in /tmp which have the same problem, but this time the change needs to be made to the filename, and in my experience this all turns into a major nightmare! The only solution I have managed to get to work is to create a new user, set up all those preferences, then copy over data files (eg docs, mp3's), and then chown them. A real pain! |
All times are GMT -5. The time now is 12:15 PM. |