Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

From a C program I would like to add "Read & execute" permission in Windows 7 for a file on a Samba drive. The "icacls" program is used in example below, but a C library call could also be a possibility if available.

The permissions can be changed for Windows users, for example Everyone, with the Windows "icacls" program (using system call), but when I try to change it for a Samba user, with name shown through Windows, then "icacls" returns:

U:\temp>icacls hello.exe /grant smbuser:RX
user: No mapping between account names and security IDs was done.
Successfully processed 0 files; Failed processing 1 files

Any idea about how I can add "Read & execute" permission to a file in Windows so the Samba (Linux) user and groups will get the Linux "x" permission set ?

share|improve this question

migrated from Jun 10 '13 at 0:08

This question came from our site for professional and enthusiast programmers.

If you set the permissions you want on the Linux side, what does icacls then show? – Harry Johnston Jun 9 '13 at 21:45
icacls hello.exe gives information, but still says: hello.exe No mapping between account names and security IDs was done. (R,W) No mapping between account names and security IDs was done. (RX) Everyone:(RX) It looks like Windows allow command line control of permissions, even through GUI control is accepted. – Morten Zilmer Jun 17 '13 at 19:43
Curious. Try cacls /s and post the result here. – Harry Johnston Jun 17 '13 at 21:45
The system is Windows 7, thus icacls is used. I got inspired by you comment, and tried to did deeper. The Samba drive is connected with different credentials than the Win user, and it appears that Win7 won't allow the icacls command change the file permissions for the Samba users SID. However, the GUI through "context menu => properties => security => permissions" allows change of permissions. And I can even save/restore for Samba user (SID) with icacls afterwards. But I can't just use the SID extracted from the icacls ... /save .... Hmm... any good ideas are appreciated :-) – Morten Zilmer Jun 18 '13 at 20:24
Windows 7 still has cacls. It's deprecated, but it's there. But icacls /save does roughly the same thing (just a bit less convenient) so you should be able to see the SID in string form (S-1-something) for the Samba users. icacls allows you to specify a string SID by prefixing it with an asterisk. – Harry Johnston Jun 18 '13 at 21:42

Your Answer


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

Browse other questions tagged or ask your own question.