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

I have a Windows server with cygwin installed and an sshd server running. I SSH in, and execute the following lines:

echo "Hello World!" > /cygdrive/c/Users/Administrator/Documents/helloworld.txt
chown Administrator /cygdrive/c/Users/Administrator/Documents/helloworld.txt
chgrp Administrators /cygdrive/c/Users/Administrator/Documents/helloworld.txt
chmod 777 /cygdrive/c/Users/Administrator/Documents/helloworld.txt
cmd /c "takeown /S localhost /U Administrator /P "@dm!np@$$" /F C:\Users\Administrator\Documents\helloworld.txt"

However, when I try to open the file in the Windows machine through an RDP session, I just get an "Access is denied" error. Any assistance is greatly appreciated.

share|improve this question
Are you sure the commands are running ok? Check the return codes. For example the last one could fail due to the nested quotes – golimar Jul 3 '12 at 16:22
If I take out the /P switch and type in the password manually, the command just hangs. – jab416171 Jul 3 '12 at 16:44
In the RDP session, check what Windows permissions the file has. – Harry Johnston Jul 4 '12 at 0:38
Try with single quotes instead of double, for the password field or for the outer ones – golimar Jul 4 '12 at 8:59
I second the single quotes suggestion by @golimar. The $$ in the password (if that is indeed the password), will expand to the process id of the current shell. Single quotes will prevent that expansion. – Fran Jul 11 '12 at 18:39

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.