Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File permission in linux vs. in windows [closed]

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

like image 373
jbu Avatar asked Nov 18 '08 19:11

jbu


People also ask

When using Windows to access Linux do the permissions still apply?

Therefore any Windows app accessing Linux files will have the same permissions as the default user.

Are there different types of permissions for Linux and Windows systems?

One of the interesting differences between Linux and Windows is in the file permission structure and management. While both operating systems are able to conceptually handle the same set of file management scenarios, they implement those permissions in different ways.

How access control in Unix is different from Windows?

Unix uses "mode bits" on each file. On NTFS, each file can have an owner, and zero or more Windows access control entries (ACEs). An ACE consists of a principal (users and groups are principals), a set of operations (Read, Write, Execute, etc.) and whether those operations are allowed or denied.


2 Answers

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).

like image 92
technophile Avatar answered Oct 04 '22 21:10

technophile


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.
like image 27
Javier Avatar answered Oct 04 '22 21:10

Javier