Thanks, Theresa.  Worked pretty well for me, too.  There's no need to
do the killall as that works off the uid.  So, to tighten it up a bit:

$ sudo usermod  -l bar -d /home/bar -m -c "bar" foo
$ sudo groupmod -n bar foo

Or in script form:

change_handle () {
  old=$1
  new=$2
  sudo usermod  -l $new -d /home/$new -m -c "$new" $old
  sudo groupmod -n  $new $old
  sudo passwd -e $new
}

Caveat emptor as it does no sanity checks.  But the jist is there.

I suspect these commands will not work for those programs that may do
additional checks, e.g. sshd or sudo.  Or if authentication is handles
by a different mechanism, e.g. NIS or LDAP.

Regards,
- Robert

On Thu, Apr 30, 2009 at 3:40 PM, Theresa Kehoe <[email protected]> wrote:
> google-fu: "ubuntu how to change userid" : first result:
>
> killall -u old
> id old
> usermod -l new old
> groupmod -n new old
> usermod -d /home/new -m new
> usermod -c “New Real Name” new
> id new
>
> (from http://www.cyberciti.biz/faq/howto-change-rename-user-name-id/ )
>
> I just tested it with Ubuntu 810 in a virtual box; the stuff on the
> desktop was there afterward, etc.  Oh, goes without saying (but
> sometimes I am like Pooh, with Very Little Brain) that you do not want
> to be logged in as "old" when you are going through the above steps.
>
> Theresa

--~--~---------~--~----~------------~-------~--~----~
Central West End Linux Users Group (via Google Groups)
Main page: http://www.cwelug.org
To post: [email protected]
To subscribe: [email protected]
To unsubscribe: [email protected]
More options: http://groups.google.com/group/cwelug
-~----------~----~----~----~------~----~------~--~---

Reply via email to