Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am desperately trying to get sitecopy to run from my computer, but the stupid thing seems to insist on reading my ~/.netrc file, even if the manpage seems to say otherwise ("If it exists, the ~/.netrc will be searched for a password if one is not specified."; see, e.g. http://linux.die.net/man/1/sitecopy)

~/.netrc does not exist in my home directory, but nevertheless, sitecopy seems to expect it, saying that it does not have the right permissions (which should be 600). And that expectation seems to be hardcoded, at least I have not found an option or switch or whatever.

I would of course be happy to simply put an empty .netrc file there and give it the right permissions, but this is where the real trouble starts: My home directory resides on a separate partition, which is formatted as NTFS, and mounted using ntfs-3g.

I have not found out yet if (and if indeed, then how) it is possible to give files on a partition mounted with ntfs-3g individual permissions. As far as I can tell, all I can control is the umask (in /etc/fstab), which then applies to all the files on the partition. Now setting the umask to 177 and accepting that all files have 600 permissions does not work because that keeps me from entering any directory on the partition (you need the execute bit of the directory set for that).

I have also tried symlinking (which works on NTFS, just in case you didn't know ;-)) to a file on a different partition where permissions can be set individually, but that won't fool sitecopy, presumably because it checks the permissions of the symlink, not of the target.

Does anybody know any solution to this dilemma, regardless at which level? The only thing that is not an option is reformatting my home partition as e3fs or something similar. (I need to dual-boot to Windoze.) I would be ever so grateful!

Best regards,

Florian

share|improve this question

3 Answers 3

You can try to fool your application, by telling it your $HOME is somewhere else.

Create a directory like /linuxhome, where you can set permissions as you like, put your .netrc in it with appropriate permissions, and then you can run sitecopy via command line :

HOME=/linuxhome sitecopy

or adapt to the actual command if it is not sitecopy.

share|improve this answer

Another possibility, on Linux, is to create the file elsewhere (for example, /var/tmp) with the correct permissions, then either symlink it (as stat() will return the symlink target's permissions)...

ln -s /var/tmp/netrc /home/user286915/.netrc

(Note: ntfs-3g creates Cygwin-format file-based symlinks, not Windows 7-format reparse points.)


...or, if this was not NTFS but a completely Unix-impaired filesystem like FAT32, bind-mount it on top of ~/.netrc every time you boot:

mount --bind /var/tmp/netrc /home/user286915/.netrc

In /etc/fstab it would be expressed as:

/var/tmp/netrc  /home/user286915/.netrc  none  bind  0  0
share|improve this answer

I have not found out yet if (and if indeed, then how) it is possible to give files on a partition mounted with ntfs-3g individual permissions. As far as I can tell, all I can control is the umask (in /etc/fstab), which then applies to all the files on the partition. Now setting the umask to 177 and accepting that all files have 600 permissions does not work because that keeps me from entering any directory on the partition (you need the execute bit of the directory set for that).

NTFS has its own ACL format, which ntfs-3g can map to POSIX ACLs (incl. basic permissions), but it is impossible to have perfect mapping, and the user needs to tell ntfs-3g the Windows SID to map each Unix UID to (each Windows installation has a different "UID namespace"), so it is off by default

(Besides, Windows does honor the "executable" permission for .exe files, it simply defaults to giving a+x to all files – and this looks ugly in ls.)

You can enable this feature by creating a .NTFS-3G/UserMapping file at the root of your NTFS partition. If you do not need compatibility with any existing Windows installation, you can add a wildcard SID:

sid="S-1-5-21-$((RANDOM*RANDOM))-$((RANDOM*RANDOM))-$((RANDOM*RANDOM))-1000"

mkdir .NTFS-3G; echo "::$sid" > .NTFS-3G/UserMapping

(The last part of the above SID is the "RID", similar to a Unix UID; they even start at 1000 for new users like in most Unix systems.)

If you do want Linux accounts to map to Windows accounts, use a tool like ntfs-3g.usermap to generate the UserMapping file – it will use the SIDs already found in the filesystem. Alternatively, boot to Windows and either use tools like whoami or look in the Registry (under HKEY_USERS) for users' SIDs.

After installing the UserMapping file, unmount and remount the filesystem, and check syslog for ntfs-3g messages.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.