Chmod .ssh/config to 664 safe? // .ssh/config (Errno::EACCES)

I was getting this error at end of vagrant up:

==> default: Adding vagrant ssh-config for example.test to ~/.ssh/config
/projectsfolder/example.com/trellis/lib/trellis/vagrant.rb:103:in `write': Permission denied @ rb_sysopen - /Users/josialoos/.ssh/config (Errno::EACCES)
	from /Volumes/Webprojekte/roots.paradisepress.io/trellis/lib/trellis/vagrant.rb:103:in `update_ssh_config'
	from /Volumes/Webprojekte/roots.paradisepress.io/trellis/Vagrantfile:150:in `block (4 levels) in <top (required)>'
	from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/plugin/v2/trigger.rb:320:in `execute_ruby'
	from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/plugin/v2/trigger.rb:173:in `block in fire'
	from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/plugin/v2/trigger.rb:142:in `each'
	from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/plugin/v2/trigger.rb:142:in `fire'
	from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/plugin/v2/trigger.rb:74:in `fire_triggers'
	from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/machine.rb:214:in `action'
	from /opt/vagrant/embedded/gems/2.2.5/gems/vagrant-2.2.5/lib/vagrant/batch_action.rb:86:in `block (2 levels) in run'

I fixed this by doing sudo chmod 664 config. Can I still consider this as safe as the official recommendation for filepermissions on /config ist 644?

Maybe someone else could share their file permissions on ~/.ssh/config ?

ok now I get Bad owner or permissions on /Users/josialoos/.ssh/config when trying to ssh in to any remote server.

What can I do now?

-rw-rw-r--   1 root       staff   698 Jun  9 09:03 config

Your problem now was using sudo when doing the chmod.

Simply change the owner back to you:

sudo chown josialoos ~/.ssh/config

The other permissions would look something like:

chmod 700 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
chmod 644 ~/.ssh/known_hosts
chmod 644 ~/.ssh/config
chmod 600 ~/.ssh/id_rsa
chmod 644 ~/.ssh/id_rsa.pub
1 Like

Aaaahhhh this was so obvious … and so easy to solve. I was having this issue for months. xD

thanks @Log1x !

This topic was automatically closed after 42 days. New replies are no longer allowed.