WebFaction
Community site: login faq
1
1

I have a static application setup for FTP uploads by certain users. I used chmod g+s so that my primary account has access to the files created by the other users, but the primary account, of course, can't setfacl or chmod the files.

Is there a way around this? I would like upload class users to upload files, but I still want the primary account to be able to change permissions on any of those files.

asked 22 May '12, 19:26

BYG
1524
accept rate: 0%


Unfortunately, there is no way to chown files as a non-root user. This is unfortunate (and I consider it a bug) as it would be preferable if chown worked by prompting for the password of the user you wish to chown files to when not being run as root, rather than simply terminating with an error.

Nevertheless, there is a workaround: you can use scp to copy the files back to the same location but via the other user's account. For example, if we have two users userA and userB and a file /home/userB/foo owned by userA. As long as both users have write access to the directory, you could log in as userA and:

scp /home/userB/foo userB@localhost:/home/userB/tmp
su - userB
mv -f /home/userB/tmp/foo /home/userB/foo

In other words, use scp to copy the file through localhost to the other user into a temp directory and move it in place; it should then be owned by userB. Using the '-r' switch can make it run recursively, just like cp.

Hope that helps!

permanent link

answered 22 May '12, 22:08

ryans ♦♦
5.0k93160
accept rate: 43%

edited 23 May '12, 04:48

That's a fair bit of sadness, but I had a feeling that was going to be the answer. Thanks.

(22 May '12, 22:17) BYG
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×20
×11
×6
×3
×1

question asked: 22 May '12, 19:26

question was seen: 2,606 times

last updated: 23 May '12, 04:48

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2019 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM