You need to be root to use
chown
, unless you are allowed to
sudo
.
So unless you log in as root, you need to do
sudo
and since
sudo
requires a TTY you need to log in, since WinSCP is not a TTY.
If you have
sudo
or are root you could just open a terminal (
Ctrl+T
) and do
sudo chown
. But if it prompts you for a password it will hang.
I have the same issue quite often, uploading files and then having to change their owner.
Either I just open in PuTTY and do it manually, but I have also made a custom command to do the same thing, it requires Cygwin+MinTTY+OpenSSH and preferably ssh-agent authentication and
sudo
without password.
d:\Software\cygwin\bin\mintty.exe /bin/bash -l -c "ssh -tp !# !U@!@ sudo chown -R !?OWNER:GROUP?myuser:mygroup! '!&'"
Not pretty, but it does work and you can select several files and change them. Since
ssh
also gives you a tty you can enter a password for
sudo
if required.
Doesn't seem to work on files/directories with spaces however.