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