1

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.

5
  • 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, 2012 at 16:22
  • If I take out the /P switch and type in the password manually, the command just hangs.
    – jab416171
    Jul 3, 2012 at 16:44
  • In the RDP session, check what Windows permissions the file has. Jul 4, 2012 at 0:38
  • Try with single quotes instead of double, for the password field or for the outer ones
    – golimar
    Jul 4, 2012 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, 2012 at 18:39

0

You must log in to answer this question.

Browse other questions tagged .