Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A GUI tool to change the short username System
Although you can easily change your "long" name in OS X, changing your short username is a messy procedure -- and that's assuming you're following the correct instructions -- even Apple's are incomplete. James Bucanek and I finally got fed up with this restriction and created ChangeShortName, a Unix script and helper application that allow you to easily change the short username. You simply provide the existing name and the new name and ChangeShortName does the rest. It even backs up your NetInfo databases for safety.

ChangeShortName is free, but please make sure you read the included documentation before using it!!

[robg adds: An older hint (and the associated comments) explain how to do this the tough way, along with a link to another name-changing front-end. I've never used any of these techniques, but this is a very popular request, so I figured one more tool couldn't hurt.]
    •    
  • Currently 2.43 / 5
  You rated: 1 / 5 (7 votes cast)
 
[29,569 views]  

A GUI tool to change the short username | 19 comments | Create New Account
Click here to return to the 'A GUI tool to change the short username' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A GUI tool to change the short username
Authored by: daybrother on May 28, '04 01:23:59PM

I followed this guy's directions, saving the script for repair if necessary. According to him in netinfo you change the permissions for your current admin account and then follow by trying to change the name of that same account. Of course, permission is denied and if you log out you have no admin account at all (if original was the install account). Running the script in repair mode immediately brought up the printing preferences panel and nothing else. I tried to log in as root but that was now disabled and would not enable from netinfo; terminal would not sudo. I left work, drove home got my install disk and "changed root password". Then I was able to login as root and clean up the damage. Although I have not looked at the code, I would not trust the script at all considering the directions for manual change. Just my HO.



[ Reply to This | # ]
A GUI tool to change the short username
Authored by: DanFrakes on May 28, '04 10:30:40PM
Daybrother, I'm interpreting your comment to mean that you didn't use ChangeShortName to change your short username -- you used the manual instructions? If so, then your comments apply to the procedure on the webpage, rather than to ChangeShortName. I'll double-check those manual instructions to see if there are any mistakes that occurred when transferring them to the Web. However, I can assure you that if you'd instead used ChangeShortName the change would have been successful.

Although I have not looked at the code, I would not trust the script at all considering the directions for manual change.

As I mentioned, it's possible there's a typo in the manual instructions. However, although the manual instructions and ChangeShortName provide the same end result, ChangeShortName is FAR more thorough and safe to use. It's been tested hundreds of times by many users and even includes a number of error-checking routines.



[ Reply to This | # ]

A GUI tool to change the short username
Authored by: daybrother on Jun 02, '04 11:10:38AM

DF:
Yes. I followed the manual instructions and when I encountered an error I used the script in "Repair" mode--it did not function as expected. Please reread my post.
I appreciate you looking into the matter; as for not using the script first: The documentation claims that the script does EVERYTHING that the manual instructions include, not, as you say now, "much more".
I now understand MY error. Perhaps YOUR error was simply in the documentation.



[ Reply to This | # ]
A GUI tool to change the short username
Authored by: DanFrakes on Jun 02, '04 07:24:14PM
Yes. I followed the manual instructions and when I encountered an error I used the script in "Repair" mode--it did not function as expected. Please reread my post.

I was just making sure I understood you; thanks for verifying.

I appreciate you looking into the matter; as for not using the script first: The documentation claims that the script does EVERYTHING that the manual instructions include, not, as you say now, "much more".

To be clear, I don't think the documentation states that. The website simply states that ChangeShortName makes the process much easier. The ReadMe included with ChangeShortName explains the additional steps/features that ChangeShortName provides.

However, since some people aren't downloading ChangeShortName before trying to change their short username manually, I agree that it would be helpful if we state on the website that ChangeShortName offers additional benefits over the manual procedure. Thanks for the feedback.



[ Reply to This | # ]

A GUI tool to change the short username
Authored by: phillymjs on May 28, '04 02:47:43PM

I've been using the procedure in the older hint for ages with machines I've built for clients, and never had any problem in either Jaguar or Panther.

For those too lazy to click the old hint :-), here's the manual way to do this that I have been using problem-free:
----------
1. Log in as an admin user other than the account you're messing with.
2. Change the shortname in Netinfo Manager. Every property whose value is the old shortname should be changed to the new shortname.
3. If the user is an admin, be sure to go into the admin group and change the value of the users property whose value is the old shortname.
4. Save your changes and quit Netinfo Manager.
5. Open up Terminal, and do a "sudo mv /Users/[oldshortname] /Users/[newshortname]" to change the name of the user's home directory.
6. Log out of the admin account and go in as the user you edited. Everything should be peachy keen.
----------

I was actually going to fool around with scripting this myself this weekend using niutil commands stuck in an Applescript applet.

~Philly

---
--
Ohhh, WHY did I register with Insta-Trace???



[ Reply to This | # ]
A GUI tool to change the short username
Authored by: DanFrakes on May 28, '04 10:00:41PM
phillymjs, for the most part, those steps are accurate, and that's exacty what ChangeShortName does. However, your steps are actually missing a number of things if you want the change to be "complete." ChangeShortName actually does all of the following:

1. Backs up all local NetInfo databases.
2. Replaces all instances of the user's short name in the /users/ NetInfo record.
3. Changes the long name (if a new long username is supplied).
4. Finds all groups to which the user belongs and updates the short name in each group to the new short username.
5. In Mac OS X 10.3, renames the user's "personal" group, if present.
6. Renames the user's home directory.
7. Renames the user's keychain file.
8. Renames and reconfigures the user's httpd (Personal Web Sharing) config file.
9. Renames any Samba access files.
10. Renames the user's crontab file.

That's really why we wrote ChangeShortName. Even Apple's Knowledge Base instructions missed a few things. Plus James added some nice error-correction code.

[ Reply to This | # ]

Resource forks ?
Authored by: ssevenup on May 28, '04 07:42:14PM

I hate to be a wet blanket but this script appears to use "mv" to do it's business. This will happily hose the resource forks of any files therein. I suggest rev. 2 should use "ditto" if you want to avoid this (been there, done that with my adduser scripts).

--MM


---
Mark Moorcroft
ELORET Corp. - NASA/Ames RC
Sys. Admin.



[ Reply to This | # ]
Resource forks ?
Authored by: DanFrakes on May 28, '04 10:03:30PM
"mv" only affects resource forks if you're actually copying files -- for example, if you're moving files between volumes. When used on the same volume, all "mv" does is update a file's directory entry with the new path/name of the file.

In other words, if you were creating a script to move a user's home directory to another volume, it would be an issue. But for this purpose, "mv" is appropriate.

[ Reply to This | # ]

Resource forks ?
Authored by: ssevenup on May 28, '04 10:48:03PM

Yup, probably true, but this always made me a little nervous. And I have read about claims to the contrary although I guess this should not be possible. It seemed like I had a resource fork issue with mv once but in my haste I couldn't stop and verify it. I would say ditto would be the preferred way anyway (just in case) but are Dev tools required for ditto to be present? Of course all of a sudden you need more free space conceivably and the process could be a lot slower.

--MM

---
Mark Moorcroft
ELORET Corp. - NASA/Ames RC
Sys. Admin.



[ Reply to This | # ]
Resource forks ?
Authored by: DanFrakes on May 28, '04 11:26:57PM
The problem with using "ditto" in this scenario is that you really don't want to copy files, or even "move" them; you simply want to change the pathname of the home directory.

If you were to use ditto, you'd basically be creating copies of everything -- you'd end up with two copies, and you'd later have to go through and delete the originals. "mv" simply keeps everything exactly where it is on the drive, but changes the logical path to those files.

So for the example of changing a short username, after changing the name you want your home directory to have the same name as your new username. A "mv" command is the safest way to do this.

[ Reply to This | # ]

Resource forks ?
Authored by: JBucanek on May 29, '04 10:57:22AM

Greetings,

As the co-author of the ChangeShortName utility, I can assure you that mv is perfectly safe and appropriate in this context.

First of all, mv preserves all resource fork and meta-data information when used to move or rename directory entries on the same logical device. mv only has problems with resource forks when asked to move a file from one logical device to another, in which case it switches to its 'cp' mode where is actually copies that file. In this mode, it uses the same code to copy the file as cp, with all of the attendant problems.

The ChangeShortName script (a) doesn't copy anything, and (b) doesn't move anything with resource forks or meta-data.

It renames the user's home directory, keychain, crontab, Samba shares, and http configurations; None of which will cause any files to be copied. It does make working copies of the httpd config files and the NetInfo database in /tmp. But these files should always be on the same volume as the source, so no copy would ever occur. Even if the user has done something radical, like relocated their /tmp directory to another volume, it's still harmless because none of these files contain any resource or meta-data information. They are all simple, flat, UNIX files which mv can copy without any problems.

Please contact Dan or I if you have any questions.



[ Reply to This | # ]
A GUI tool to change the short username
Authored by: JohnITG on May 29, '04 05:26:25PM

I used to do the netinfo thing then came along "Accounts Enhancer" from
the author of Cocktail. Very simple, very quick and it works!! Just have to
fix a couple of minor perf's like reslect your theme in Shape Shifter.

I give this one 5 Mice...

http://www.macosxcocktail.com/accountsenhancer/



[ Reply to This | # ]
A GUI tool to change the short username
Authored by: dogboy on May 30, '04 03:49:50PM

So why does the Panther version try to mount a remote disc image? It is hard to trust a tool which has such potential to hose your system when it is delivered by the very method all the recent security worries have been concerned with.



[ Reply to This | # ]
A GUI tool to change the short username
Authored by: DanFrakes on Jun 01, '04 04:45:59AM

I did some testing with Accounts Enhancer tonight, and it unfortunately doesn't do a complete job of changing your short username. Specifically:

* It doesn't update all groups to reflect the new short username. If you (or other software) have created groups, those groups will not reflect the new short username and, thus, will no longer include your account.
* It doesn't update the Web Sharing (httpd) settings to reflect the new short username. After changing your short username using Accounts Enhancer, Personal Web Sharing will no longer "serve" your personal Sites folder.

It also doesn't back up your NetInfo database or perform any error-checking that I could determine.



[ Reply to This | # ]
A GUI tool to change the short username
Authored by: alexg@ebi.ac.uk on Jun 01, '04 08:15:43AM
Something went wrong when I tried this, and I found there were some steps missing in the repair/recover section of the docs.

You need to bring up the localhost with

ifconfig lo0 127.0.0.1 up

and the local netinfo server with

netinfod -s local

before you run the recover command

niload -d -r / -t localhost/local < local-ChangeShortName....
This had me panicked for a while so I thought other people might be in the same boat...

[ Reply to This | # ]
A GUI tool to change the short username
Authored by: JBucanek on Jun 01, '04 03:35:05PM

alexd,

I'm sorry to hear you had trouble running our script, but I'm afraid that we can't do much about your particular situation, and I'm not inclined to make any changes in the documentation based on your results.

Under normal circumstances, lo0 should never be down. Likewise, netinfod should always be running. (And note that you should have started netinfod as root.)

Normal users can't encounter these conditions. On the other hand, if you are using ifconfig to alter your network connection state, or stopping netinfod for some bizarre reason, you must accept the functional conflicts that are bound to result.

There are actually lots of possible conditions that would cause out procedure to file, and that we can't anticipate. Maybe you replaced your home directory with a dynamic mount point. Maybe your httpd config files are dynamically generated. Any of these would cause our procedure to fail. But if you are making these kinds off modifications to your system, it's expected that you know what to do about it.



[ Reply to This | # ]
A GUI tool to change the short username
Authored by: elmimmo on Sep 06, '04 12:53:35PM

Are you sure about that? Note that one would only want to type those commands when entering single user mode, as suggested in your Docs, in case something went wrong. Is netinfod really supposed to be running when in single user mode.

Whatever the answer is, I also had problem (ChangeShortName simply created a new user but did not mv the former user home folder), and niload just stays there doing nothing. Top revealed netinfod is not running when booting in single user mode, but unfortunately following alexg advice did not make niload work either.



[ Reply to This | # ]
A GUI tool to change the short username
Authored by: buttonkim on Mar 18, '10 11:00:25AM

How do I download your free tool? I am new to this site. Probably just overlooking it, but in a bit of a bind. Thanks.



[ Reply to This | # ]
A GUI tool to change the short username
Authored by: Litlhawk on Dec 03, '10 08:22:59AM

I used Dan Frakes' terrific ChangeShortName donation-ware to change my shortname in OSX 10.4 - is was so easy, esp' after reading the scary technical versions. My challenge: the change seems to have affected my network connections, specifically Yahoo Messenger and outgoing Mail emails. Any idea on how to fix it ?

thanks !



[ Reply to This | # ]