Subject: SFTP: changing the owner of a file / directory without changing the group

From: Terra Frost <[email-masked]>
Date: Sat, 16 Feb 2013 11:35:43 -0600

In SFTPv4+ there's an SSH_FILEXFER_ATTR_OWNERGROUP attribute flag that
takes in strings. In SFTPv3 and earlier there's a
SSH_FILEXFER_ATTR_UIDGID attribute flag that pretty much does the same
thing but takes in integers.

My question is...  why are the owner and group being set at the same
time? On Linux it's not chowngrp - it's chown and chgrp as separate
commands. Why aren't they separate values in SFTP?

I guess if all one wanted to do was set the owner one could do
SSH_FXP_STAT to get the the group and then update the owner to the new
owner and update the group to be the same group that it was before but
that seems like it ought not be necessary - that if SFTP were still
being developed as a protocol that that's an area that could benefit
from improvement?

---

From: "S.P.Zeidler" <[email-masked]>
Date: Sun, 17 Feb 2013 22:19:08 +0100

Hi,

> commands. Why aren't they separate values in SFTP?

Even Linux' chown(2) handles setting owner and group in the same call.
See http://www.kernel.org/doc/man-pages/online/pages/man2/chown.2.html

It also says:
If the owner or group is specified as -1, then that ID is not changed.

This is POSIX behaviour.

regards,
	spz
-- 
[email-masked] (S.P.Zeidler)