Install umask for remote commands

How can I direct processes running on remote machines via ssh to start with a specific umask? I want this to apply to commands executed as part of the standard Capistrano recipes, so I cannot just make an explicit call to the umask part of the command.

It doesn’t work that ~ / .bash_profile is being read on the remote computer because Capistrano calls remote commands.

+4
source share
4 answers

I ran into the same problem and circumvented it, then using undocumented SSHKit.config.umaskin config/deploy.rb. Note that for each ssh command is installed umask.

+2
source

umask 0002 .bashrc , .

+2

Alain - umask .bashrc .bash_profile. Capistrano .bash_profile . .bashrc .bash_profile . , .bashrc, , , capistrano.

- umask, . , Cap 3 :

task :set_umask do
  on roles(:all) do |host|
    execute "umask 0002"
  end
end
before "deploy:starting", "set_umask"
0

@beauby SSHKit , Capistrano 3, Capistrano 2 SSHKit.

umask Capistrano , bundle install . , Capistrano 2, , :

namespace :bundle do
  task :postinstall do
    run "chmod -R u=rwX,go=rX #{bundle_dir}"
  end
end

after 'bundle:install', 'bundle:postinstall'
0

Source: https://habr.com/ru/post/1524576/


All Articles