Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Change owner ship

@Dheeraj: It can be done server-side using a tool like inotify. You can use it to trigger ownership change every time a new file is created.

Or the cron solution as suggested by @PascalBoulerie. Though that's not as elegant.
Dheeraj

Change owner ship

Hi

While transferring file I need to change owner and group owner ship. I don't want to give sudo access to developer. Is there any alternative solution.

Thanks in advance!
ddur

Thanks
martin

@Pathduck: Nice solution! You should be able to the same with Plink (to reduce dependencies).
Pathduck

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

Hi, thank you for WinSCP!

I have similar case, Windows -> Debian.
Cannot login as www-data user, so I need to change owner for every new upload.
I there any other way to automagically change owner on new upload, except cron solution mentioned above?

Thanks.
martin

@Guest: Rights are copied. And most users won't have permissions to change file ownership.
Guest

Thanks @martin.

I've disabled the "temporary files"-option and this should solve my problem.

Still, please consider copying the owner/rights of the original file to the temporary before deleting it.
Pascal Boulerie

Re: Changing File Owner on Overwrite – after (workaround)

Here is a workaround: the admin can set up an automatic [m]cron[/m] task that changes the file properties and owner every 5 minutes.
Guest

Changing File Owner on Overwrite

I'm uploading files to a webserver with WinSCP. Local computer is Windows, remote Debian.

Sometimes files change the owner to the account im connecting with when overwritten. This only happens with certain files. In this case it's an .sql file.
Most files (mostly *.php) keep the owner of the previous version of the remote file.

How can I disable/prevent that ownership-change from happening?

Also: A setting would be nice to automatically set the owner of new files to the same owner as the director I'm uploading it into.

Thanks in advance!