sftp and file ownership

Hi all,

I mount remote directories from my webservers to my desktop running GNOME (the "Connect to server" command in Nautilus) so that I can edit config files and the like in gedit, which is extremely convenient.

In a terminal, if as root you edit a file belonging to, for example, "www", the owner remains the same. But via sftp, root becomes the owner. This obviously causes all kinds of unexpected problems for Apache etc.

I have been looking in the sshd_config man page but I don't see a setting that might affect this.

Is this ownership thing inherent to sftp? Is the only solution logging in as the same user as Apache?
 
cbrace said:
Is this ownership thing inherent to sftp?
It's inherent to FTP, so yes. Do note that most FTP clients, including sftp, support commands such as chown(1) and chmod(1).

cbreace said:
Is the only solution logging in as the same user as Apache?
Logging in as root ought to be used sparingly anyway and using root over SSH or (S)FTP is highly discouraged (and in fact disabled by default).
 
Back
Top