Archive

Archive for May, 2010

Ad’hoc distribution and expired certificate

Once a year, your iPhone Developer Distribution certificate will expire. This will involve the not-so-big-but-nonetheless-boring process to create new private keys, request the certificate, install it in xCode, et caetera.

But once this is done… you’re not finished yet! Remember of this friend of your’s you made a special app for you distributed through Ad’hoc? Its provisionning profile for this app is expired too… Now you’ll have to generate a provisionning profile again, with your brand new Distribution certificate, send it to him, and… huh, no, that’s not finished yet: you have to rebuild your application, since it needs to be signed with your new certificate!

(If you don’t rebuild the app, when trying to install with the new provisionning profile, your friend will get a “invalid signer” alert message.)

Wow! Finished all this? This time you’re done… hopefully.

Advertisements

AFP (Apple File sharing Protocol) issues when sharing between same user

Here was my problem: I have 2 Macs, with one user account on each of them. Both user accounts share the same username (quite easier, isn’t it?). I use Mac B to connect to Mac A with my user’s login/password, I go through my files on Mac A, which I can read, but impossible to edit or create anything! Seems I’ve no write rights! Same problem in the other way! But no problem when connecting with Mac B to another user account on Mac A!

NB: the considered user accounts have administrator rights on both Mac, and all files have read/write permissions for this user.While I don’t think it is of any importance, I performed a migration of the user account from Mac A to Mac B with the “Migration Assistant” tool provided in MacOS X. My both Macs are under Snow Leopard 10.6.3, but this seems to be a common issues between numerous versions of OS X.

Googling a little a good hour, I found the explanation, and a solution. The reason is that, while the user accounts on Mac A and Mac B share the same username, they do not share the same UID (Unique ID, a number used by the system to identify a user account – it is generally hidden to the user, replaced by the username). This is due to the fact on Mac A, I created another user account before this one, so it took the 502 UID. On Mac B however, it was the first one so it took the 501…

Don’t ask me why, but this is the reason of all these write permissions problem, so now, how shall we address this issue? The solution is quite technical, and may be risky if you do not master what you’re doing, so please be prudent, and remember I shall not be taken responsible of any consequence of your acts! If advise you to do this only if you already know what the Terminal is, and how to use it. If not, ask a friend!

To fix this issue, you will indeed need to change your user’s UID manually. This requires terminal manipulation…

  1. First, you should check you really have the described problem (UID inconsistency). For this, you can execute the following command on both Macs: dscl . -read /Users/replace-with-your-username UniqueID. It should give you an answer of this form: UniqueID: 502. If answers are not the same for both Macs, you have this problem, and this is probably the cause of your file sharing issues.
  2. You now have to change your UID on one of the Macs to match with the one on the other. Be sure not to change to a UID already used by another user account in case you have multiple users on the Mac you wish to make the change on. For this, use the following command: sudo dscl . -change /Users/replace-with-your-username UniqueID replace-with-originalUID replace-with-targetUID. This will change from originalUID to targetUID.
  3. Finally, you need to update your whole user’s folder permissions to match your new UID. Since the terminal you’re logged in do not know you anymore (you changed your UID, remember?), you should open a new one (asked a password in my case), and use the following command to update your UID for all your files: sudo chown -R replace-with-targetUID /Users/romain/.
  4. Finally give your Mac a restart, it will help him not loosing track of you!

If you did this, I hope it worked for you as it did for me! You can give a eye to the following pages which I used to identify the issue and solution, if you want to be sure before doing it:

http://discussions.apple.com/thread.jspa?messageID=7176565

http://osxdaily.com/2009/02/19/mac-os-x-change-your-user-id/

%d bloggers like this: