My weird Leopard / XP file sharing issue

Discussion in 'Mac Basics and Help' started by obdave, May 26, 2008.

  1. obdave macrumors member

    Joined:
    May 25, 2008
    #1
    Hi everyone, I'm new to the forum.

    I recently decided I'd had enough of that crappy Redmond operating system. I finally made the plunge and bought a Mac Mini. I still need an XP machine because all of my development tools require it, but I've decided to move the rest of my life (email, web stuff, contacts, etc) over to the Mac and try life in that world for awhile. I've had it about three weeks, and so far so good. I'm enjoying it. The last time I used a Mac was about 20 years ago. I had a Mac IIcx at work, and I remember what a big deal System 7 was when it came out. Oooh! Anyway, I've been away too long.

    Anyway, there are only a couple issues with the Mac Mini that are vexing me. The biggest one is file sharing with my XP machine.

    The Mac is able to read and write to folders that are published on the XP machine. I'm not having any problems there at all. Thing is, the XP machine is a loud noisy beast, whereas the Mac Mini is pretty quiet. And it has Time Machine. So I want to host all everything from my old XP machine's "My Documents" tree on the Mac.

    First of all, I didn't have any luck publishing a directory under the Mac's "Documents" folder, i could not get it to appear on the XP machine. And the Mac's Public folder was a bit wonky too. The PC can read (but not write) files in the Public folder, with the exception of the Dropbox, which it can write to but not read.

    Finally, I figured out that if I created a directory within the Public folder, I could get that to share. So I pushed over a bunch of files from the PC. Then I discovered that I couldn't write to them from the Mac. I figured that it must be some sort of a weird permissions issue. Like I said, I'm new to the Mac but I'm pretty familiar with *nix, so I opened up a terminal window and discovered that the contents of the directory were owned by "nobody" and the permissions were set to to world and group read-only. I chose a brute-force approach, and did a "sudo chmod 666" recursively on everything. (This changes the file permission to read and write for owner, group, and world.) Brute force, I know. I'm looking for a better way.

    This apparently isn't it. I discovered that after I write to a file from the PC, the permissions change back to world and group read-only. Here's an example:

    -rw-r--r-- 1 nobody staff 40960 May 25 12:38 Timesheet.xls

    In this case, its an Excel sheet. If I modify the sheet on the PC, it becomes read-only on the Mac because I'm not "nobody."

    So then I tried to "chown" the file so it belonged to my Mac username instead of "nobody." But as soon as I write to the file from the PC, the ownership changes back to "nobody" and I can't write to it from the Mac until I change the permissions again.

    I'm wondering if the issue has something to do with how I connect from the PC, but I am never asked for a username or a password - the Mac's public folder just shows up in My Network Places. I'm guessing the PC is connecting as nobody, and maybe that's the cause of my problems.

    I've searched through the forums and haven't seen a problem reported quite like this. Has anyone seen this problem before? What am I doing wrong?

    Regards,

    Dave
     
  2. tilman macrumors regular

    Joined:
    Feb 28, 2006
    #2
    Sounds like you are not properly authenticating when you connect to the Mac's shared folder from XP. In Explorer, when you do "Tools -> Map Network Drive" to map your Mac's shared folder to a drive on your XP machine, click on "Connect using a different user name". Enter your Mac user name and password, then connect.
     
  3. obdave thread starter macrumors member

    Joined:
    May 25, 2008
    #3
    Thank you, thank you! I don't know how I missed that before.

    I actually had quite a bit of trouble with this. I kept trying to disconnect the improperly mapped drive, and it kept reappearing on its own and then XP would honk at me for trying to map a drive it thought was already mapped, even though it was showing up as disconnected. Googled, and it turns out that the problem is fixed by deleting a registry key, naturally.

    http://www.pcreview.co.uk/forums/thread-1871516.php

    Bleh. I really loathe Windows.

    Anyway, once that was done, I was able to map the drive using my Mac username and password, and now I can see that when I modify the file from XP, when I look at the file on the Mac side the ownership is correct.

    Because the drive was mapped incorrectly when I first pushed all the files over from XP, all the file ownerships in this tree were wrong. So I went through and did a sudo chown on everything in the tree so that I now own everything. Once that was done I recursively removed world and group read and write permissions from everything. Don't know if that last step was actually necessary, but it seems like a sensible bit of security.

    Anyway, thanks again for the prompt reply.
     
  4. obdave thread starter macrumors member

    Joined:
    May 25, 2008
    #4
    epilogue

    Interestingly enough, my XP machine forgot the correct login and reverted to the wrong one. Turns out, after having consulted the oracle again, that there are several sets of registry keys that have to be deleted, then reboot, then delete the keys again. I never did get all of them to disappear for good, but it looks like I killed enough of them, or the right ones, that the XP machine appears to be behaving a little better. I'll give it a few more days before I'll swear to it. It's the kind of thing that makes me want to kick Bill Gates in the nuts. Come on, guys, you've been at this for HOW long?

    The Mac, meanwhile, is performing just fine. Somebody please explain to me why I didn't get one earlier....
     
  5. obdave thread starter macrumors member

    Joined:
    May 25, 2008
    #5
    well, that didn't last long...

    OK, well that didn't last either. There's some sort of bug in XP's map drive mechanism. If you go under Tools>Map Network Drive, there is some sort of incompatibility with the "reconnect at login" button, and connecting with a different user name. I literally have spent hours futzing around with this thing, deleting crap out of the registry, and finally, playing with the NET USE command.

    As soon as you click the "reconnect at login" button some bad mojo happens. You would think you would want to be able to select this button, so that every time you power up / log on, the drive gets mapped for you automatically. Unfurtunately, the second you touch that button the XP machine immediately connects to the Mac share anonymously, so that by the time you push the "finish" button 100 milliseconds later, XP honks at you with an error message about the drive already being mapped with a different username. The drive then shows up as a disconnected network drive, but if you try to disconnect it, it doesn't show up in that list. Pain in the ass! So then you have to search through the registry and delete keys referring to that share. It's ugly.

    I have found a solution that works. It's ugly too, but at least its behavior is consistent, which is certainly step forward. Instead of using the GUI to map the drive, shine all that on. I'm using the DOS BOX "NET USE" command. I have a one-line .BAT file that executes that command. Since I am using XP Home, I don't have support for proper user login scripts, but Googling around I found a cheesy-ass workaround.

    Step 1: Figure out the net use command. If you open a Command Prompt (aka DOS box) and type NET USE, you can see your current network mappings. NET USE /HELP tells you the syntax. It may also be useful to go to My Network Places to see exactly how the Mac shows up on the Windows side.

    I would just post the batch file here, but the Mac password appears on the command line. So let's say my name is Bill Gates, and that's the name of my user account on my Mac, which is called Mac-mini (that's how it shows up on the Windows machine). My hypothetical password on my Mac is melinda.

    This is the exact DOS command to map to my public folder to the PC's M: drive:

    net use m: "\\Mac-mini\bill gates's public folder" melinda /user:"Mac-mini\Bill Gates"

    It took some tinkering to get this right. You need the quotes if there are spaces in the share name, user name, etc. If you get it wrong, you can delete the M: mapping by typing

    NET USE M: /DELETE

    I found it useful to map the drive, write to a file somewhere in the Mac share, then go to the Mac and look at the file ownership and permissions. If the mapping is done correctly, the file will show up as having been written by the Mac user, which would be "Bill Gates" in this hypothetical example.

    Getting the NET USE command correct is the hardest part.

    Step 2: After you're done tinkering with the NET USE command, and you have the syntax correct, copy the text of the command. (Remember, in a DOS box you have to first right click and choose "Mark" before you can select any text, then right-click "Copy")

    Open Notepad and paste the NET USE command into a new text file. Save the file as a .BAT file in the PC's c:\Documents and Setting\[username] directory. I called mine MAPMAC.BAT.

    Note, you now have your Mac password sitting as plaintext in this batch file. Not good! If anyone has a better solution, please post it. At this point I'm too tired of this problem to go looking for a solution to that just yet.

    Step 3. Make a shortcut to this .bat file file and put it in c:\Documents and Setting\[username]\Start Menu\Programs\Startup

    This will cause the batch file to get executed whenever that user logs in.

    Gee, that was intuitive, wasn't it?
     
  6. borretts macrumors newbie

    Joined:
    Jan 23, 2009
    #6
    XP automatically changing file permissions

    The core problem raised in this thread has not yet been addressed, and I need to know how to solve it. I have multiple people sharing documents stored on a mac server share point, which is accessed from Windows XP, Mac, and linux machines. I initially set the permissions so that the original user and the group could read and write the files. Now, when someone modifies and saves the file from the Windows XP terminal, it changes the file owner to the current user and resets the permissions so that the rest of the group can no longer access the file.

    Is there a way to maintain the file ownership and permissions? What am I missing here?

    Thanks in advance.
     

Share This Page