Prompt
How can I migrate a Windows or Linux file server used by an app into the cloud without breaking permissions?
Latest observation
Migrating a Windows or Linux file server into the cloud without breaking permissions is mostly about preserving three things:
- Identity mapping — users/groups must mean the same thing in the cloud
- ACL fidelity — file/folder permissions must be copied accurately
- Application path/behavior compatibility — the app must still see the same shares/paths and access model
Below is a practical approach that works for both Windows and Linux file servers.
1) First, inventory what you have
Before moving anything, document:
- Protocols in use
- SMB/CIFS for Windows shares
- NFS for Linux/UNIX shares
- Permission model
- Windows ACLs, NTFS inheritance, share permissions
- Linux POSIX permissions, ACLs, ownership, groups, SELinux/AppArmor
- Identity source
- Active Directory
- LDAP/FreeIPA
- Local users/groups
- Mixed environments
- Application dependencies
- Hardcoded paths?
- UNC paths like
\\server\share - Linux mount paths like
/data/app - Service accounts running the app
- Special file features
- Symlinks/junctions
- Alternate data streams (Windows)
- SACL/auditing
- File locks
- Sparse files
- Case sensitivity issues
This inventory tells you whether you can do a straight lift-and-shift or need identity modernization first.
2) Make identity the center of the migration
Permissions only survive if identities survive.
For Windows file servers
Best practice:
- Join the cloud file service or VM to the same Active Directory domain or a trusted domain
- Ensure user/group SIDs remain consistent
- If moving to a managed cloud file service, confirm it supports:
- AD domain join
- SMB ACL preservation
- NTFS-like permissions
- Kerberos authentication
For Linux file servers
Best practice:
- Keep using the same LDAP/AD/FreeIPA identity backend if possible
- Ensure UID/GID consistency:
- A user with UID
1001on-prem must still be UID1001in the cloud if you rely on POSIX ownership
- A user with UID
- If using AD-backed Linux auth, verify:
- ID mapping rules
- NSS/PAM configuration
- Home directory/path mappings if relevant
Important: if usernames are the same but SIDs/UIDs differ, permissions can appear “broken” even if filenames copied correctly.
3) Choose a cloud target that preserves permissions
You generally have three options:
Option A: Lift-and-shift to a cloud VM
- Move the file server to a Windows/Linux VM in the cloud
- Best for maximum compatibility
- Preserves:
- SMB/NFS behavior
- ACLs
- app expectations
- Needs:
- OS management
- patching
- storage attached and formatted correctly
Best when: the app is sensitive and you want minimal change.
Option B: Managed cloud file service
Examples:
- Windows workloads: SMB file services integrated with AD
- Linux workloads: NFS-based managed storage or self-managed NFS on cloud VMs
Pros:
- Less operational overhead
- Better scalability
Cons:
- Not every edge case is supported:
- Some ACL features
- Symlinks
- inheritance semantics
- locking behavior
- quota/auditing differences
Best when: you can validate compatibility and want less infrastructure management.
Option C: Refactor the app to object storage or a new file access model
- More future-proof
- Usually breaks assumptions
- Not ideal if your goal is “without breaking permissions”
Best when: you’re modernizing, not just migrating.
4) Preserve permissions during copy
For Windows/SMB
Use a copy tool that preserves:
- NTFS ACLs
- owner
- timestamps
- attributes
- audit entries if needed
Typical approach:
- Use robocopy with security-preserving flags
- Example:
/COPYALLto preserve data, attributes, timestamps, security, owner, and auditing/SECFIXto fix security on existing files/MIRonly if you truly want a mirror and have tested deletion behavior
Be careful: copying with Explorer or a basic file copy tool will often lose ACLs or ownership.
Also verify:
- The destination filesystem supports Windows ACLs
- The cloud SMB share honors them
- The file server is joined to AD and can resolve SIDs
For Linux/NFS/POSIX
Use tools that preserve:
- ownership
- group
- mode bits
- ACLs
- extended attributes if needed
Common method:
rsync -aHAXfor archival/metadata preservation:-aarchive-Hhard links-AACLs-Xextended attributes
Also check:
- UID/GID alignment on the destination
- Mount options
- NFS export options
- Whether SELinux contexts need restoration
If UID/GID mappings change, files may copy fine but appear owned by the wrong user.
5) Handle permissions at both share and file level
This is often missed.
Windows
There are two layers:
- Share permissions
- NTFS permissions
A user must be allowed by both. When migrating:
- Recreate share permissions
- Preserve NTFS ACLs
- Confirm inheritance behavior
- Verify the app uses the same account or group membership
Linux
Access may depend on:
- file mode bits
- ACLs
- ownership
- group membership
- mount/export permissions
- root squash / anon UID on NFS
Make sure the cloud target replicates the same access model, not just the same data.
6) Test with real application identities
Do not test only as an admin.
Validate access using:
- the app service account
- standard user accounts
- any batch/job accounts
- read/write/delete operations
- create/rename/move operations
- file locking behavior
- nested folder inheritance
Use the actual application workflow if possible, because many apps fail on:
- rename semantics
- exclusive locks
- case sensitivity
- latency
- missing hidden files
7) Use a staged migration, not a big-bang cutover
Recommended pattern:
Phase 1: Prepare
- Set up cloud file server/storage
- Join identity systems
- Configure shares/exports
- Test permission mapping
Phase 2: Initial sync
- Copy data while users are still on the old server
- Preserve ACLs/ownership
- Log discrepancies
Phase 3: Delta sync
- Re-copy changes periodically
- Keep source and destination in sync until cutover
Phase 4: Cutover
- Freeze writes on the old server
- Final sync
- Switch DNS, UNC paths, or mount targets
- Validate application function
Phase 5: Decommission old server
- Only after a validation window
This reduces downtime and lets you correct permission mismatches before users depend on the new server.
8) Use DNS or aliases to avoid app path changes
If the app points directly to \\oldserver\share, avoid rewriting config everywhere.
Instead:
- Use a DNS alias / CNAME where possible
- Or a DFS namespace for Windows environments
- Or a mount point/alias on Linux
This helps preserve:
- application config
- scripts
- scheduled jobs
- user bookmarks
Be aware: some SMB/Kerberos setups need proper SPN registration when using aliases.
9) Watch for cloud-specific permission gotchas
Common issues include:
- SID/UID mismatch
- Unsupported ACL semantics
- Case sensitivity differences
- File locking differences
- Kerberos/SPN configuration problems
- SMB dialect differences
- NFS
root_squashbehavior - Clock skew affecting Kerberos
- Trailing spaces or reserved filenames
- Path length limits
- Cross-platform newline/encoding differences
- Cloud backups or snapshots not preserving metadata as expected
10) Validate with a permission audit
After migration:
- Compare source and destination ACLs
- Check effective access for representative users/groups
- Validate ownership and inheritance
- Compare file counts and sizes
- Check hash/sample integrity for critical data
- Audit access logs if enabled
A good validation approach is:
- pick several folders with different permission patterns
- test access from regular users and service accounts
- verify read/write/delete across inherited and explicitly set permissions
Practical recommendation by workload
If it’s a Windows file server for a Windows app:
- Use Windows Server in the cloud or a managed SMB service integrated with AD
- Migrate with a tool that preserves NTFS ACLs
- Keep SIDs and share names consistent
- Use DNS aliases/DFS for cutover
If it’s a Linux file server for a Linux app:
- Use a Linux VM or NFS-capable managed service
- Preserve UID/GID, ACLs, xattrs
- Reproduce mount/export settings
- Test as the app service account
If it’s mixed Windows/Linux access:
- Be very careful about identity mapping
- Consider standardizing on AD/LDAP-backed authorization
- Test both SMB and NFS clients if both are used
Simple rule of thumb
If you want to avoid broken permissions, don’t treat the migration as “copy files to cloud.”
Treat it as:
replicate identity + replicate permissions + replicate access protocol + then move the data
If you want, I can give you:
- a Windows-specific migration checklist,
- a Linux-specific checklist, or
- a tool-by-tool plan for AWS, Azure, or GCP.