Skip to content

Change upload behaviour that fix permission issue#37

Open
Paprikas wants to merge 1 commit into
TalkingQuickly:masterfrom
Paprikas:master
Open

Change upload behaviour that fix permission issue#37
Paprikas wants to merge 1 commit into
TalkingQuickly:masterfrom
Paprikas:master

Conversation

@Paprikas

Copy link
Copy Markdown

The problem happens when you, for example chown logrotate config files to root. Then permission issue will happen if deploy_user is not root.

The problem happens when you, for example chown logrotate config files to root. Then permission issue will happen if deploy_user is not root.
@TalkingQuickly

Copy link
Copy Markdown
Owner

Thanks for the PR, the tricky thing is that the smart_template method is used for multiple files and this change would mean that every file ending up being owned by root which isn't the behaviour needed.

Potentially we need another way of indicating that certain files should be chowned to root after upload. I'll have a bit of a play over the weekend and see if I can come up with something. Any suggestions much appreciated!

@Paprikas

Paprikas commented Apr 2, 2015

Copy link
Copy Markdown
Author

No. It's not chowned after upload.
I mean if your file is ALREADY chowned. So upload! method will fail because of lack of permissions.

Here is what I did previously to chown logrotate config.
After this line:
https://github.com/TalkingQuickly/capistrano-3-rails-template/blob/master/lib/capistrano/tasks/setup_config.cap#L29
I've added this:

sudo :chown, symlink[:chown_source], "#{shared_path}/config/#{symlink[:source]}" if symlink[:chown_source]

Now in config/deploy.rb
I've added needed option

set(:symlinks, [
    {
      source: "nginx.conf",
      link: "/etc/nginx/sites-enabled/{{full_app_name}}.conf"
    },
    {
      source: "log_rotation",
      link: "/etc/logrotate.d/{{full_app_name}}",
      chown_source: "root:root"
    }
])

So I can choose what user I need to be the owner.
Yes, its not the universal method for every uploaded file. But I had problem with logrotate config permissions. So it works perfectly for me.
I get the idea.

@ziazek

ziazek commented Sep 9, 2016

Copy link
Copy Markdown

Facing the same issue. Trying out this solution.

@ziazek

ziazek commented Sep 9, 2016

Copy link
Copy Markdown

Still not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants