views:

1372

answers:

2

Hi all,

In linux, if I have a file I'm sharing with a group, and I put the file on a USB memory stick, for example, and copy it to a computer that doesn't have the same group or users, does the file have no permissions for anyone on that new computer? What if I bring a linux file that only lets user X to read it to a windows machine? Who gets to read it on the windows machine? since user X (and group) doesn't exist on that machine.

What kind of security do I get copying a linux file to another linux machine? how about to a windows machine?

What kind of security do I get copying a windows file to another windows machine? how about to a linux machine?

Please let me know.

jbu

+12  A: 

Regarding the USB key: generally, USB keys use one of the FAT family of filesystems; FAT doesn't support security at all, so as soon as you copy the file to it the security information is lost. So for your first question, anyone who has the USB key can read it on any computer from any user account. It is possible to format USB keys using another filesystem (for example, NTFS, which does support security); in that case, if the accounts (in Windows, at least, it must be a domain account or similar, just naming two accounts the same will not do it) do not exist on the target computer, only a user who can ignore filesystem permissions (such as root on *nix or Administrator on Windows) will be able to access the file.

For the second, I'm not 100% sure but I believe it depends on how you copy it; things like FTP and rcp generally don't copy permissions over, so I would assume that the file gets some kind of default permissions for the target directory, or a default built into the copy program, depending on what the copy program does.

For windows, to the best of my knowledge the security descriptor is initially inherited from the target folder; permissions are, again, not persisted across machines. It can be modified after the copy.

In general, except in specific environments that are designed to transfer permissions, I would assume that transferring any file from one computer to another resets the security permissions to a default (generally whatever a new file in that location would receive).

technophile
nothing is preventing you to format USB key as ext3 or any other filesystem. Question of usability of this key should be raised however.
Ilya
I believe Ilya is correct about the ext3. I don't know what you mean by "Question of usability of this key should be raised however."
jbu
There exists an ext2 filesystem driver for Windows, but it's not available for all versions, not supported and not installed by default: such a disk would be harder to use in Windows.
Chris Smith
That's true; similarly, a key formatted with NTFS will be unusable on Windows 95/98/Millenium PCs, although those are probably fairly rare at this point.
technophile
By usability i meant that it will be not recognized by majority of PC's. Although the ext2 driver exists for Windows it's definitely not installed on the most system and the quality is questionable from my experience,
Ilya
+5  A: 

as technophile said, removable drives usually use FAT filesystems, so no permission info is copied at all.

on more 'direct' copies between *nix machines, if the writing process is run under root, usually there are flags to preserve permission bits and owner/group. also, most of them preserve user/group identities by the numbers. if there's no 'global' user identity database (LDAP, NIS, or even AD), be sure to look for a 'by name' identity.

some examples:

  • NFS: assumes 'identity by number', unless you use some 'squash' option to make every file the same owner/group.
  • cp: the '-p' flag preserves mode, ownership (by number) and timestamp.
  • scp: the '-p' flag preserves modes, but (usually) not ownership
  • rsync: only root can preserve ownership (-o,-g, or -p), tries to match usernames, but falls back to userids if not possible.
Javier