rmyorston / busybox-w32

WIN32 native port of BusyBox.
https://frippery.org/busybox
Other
674 stars 124 forks source link

chown and chmod implementations #361

Open doctorpangloss opened 1 year ago

doctorpangloss commented 1 year ago
chown -R `whoami` C:/some/path

is equivalent to

icacls C:/some/path /setowner "$USERNAME" /t

for adding permissions

chmod -R u+rwx C:/some/path

is equivalent to

OWNER=$(powershell '(Get-Acl "C:/some/path").Owner')
icacls "C:/some/path" /inheritance:e /t /grant:r "$OWNER:F"

there isn't a direct equivalent as you say. the underlying pain point is really the absence of a sudo implementation, so users start shells with administrative privileges, and then write directories owned by an administrator. then they discover there's no "easy" way to reset the privileges as though they were written by the ordinary user.