Every time I power cycle the machine the .ssh folder permissions are reset and become too open for ssh.

I need to physically go to the machine and

chmod 0700 ~/.ssh

before I can ssh in (otherwise I get a permission denied (publickey) error) What would do that on boot up and how can I prevent it?

The machine is going to be deployed in a location that is not easily accessible to me, so I can't have it setup in a way that requires me to be there every time it is rebooted.

In case this is useful information. The machine is a fairly basic setup, Ubuntu Server 14.04 with nginx, php-fpm, mysql server, git, openssh. It has an SSD and 2 HDDs setup with RAID1.

Other than installing the OS & software, the only things I've done to the machine are: add a site to nginx, setup a database in mysql, and copy the public keys (from the 3 machines that will have access) into ~/.ssh/authorized_keys

The only none vanilla/standard things on there are: I mounted the RAID "drive" to /vol/ moved the mysql folder to /vol/mysql/ and cloned the webapp from github to /vol/www/


You can make this command to execute every time you boot your system using the 'Startup Applications' that is available by default in ubuntu.

Just type 'Startup Applications' in the dash board. An application will open. Click Add button in the application and type the command (In your case, its chmod 0700 ~/.ssh) and u can also specify the Name and Comment for that command.

Now, every time you boot your system, this command gets executed automatically. You can also take a look on adding the startup programs on command line here

  • It's a headless server, but yes, I was thinking of adding the command to crontab or whatever the statup bash script is as a workaround. It just seems like an odd behavior and I'd like to know why it is happening. – mike Mar 15 '15 at 23:38
  • In ubuntu, certain things like this gets reseted every time you reboot and this is not an odd behavior. You can add the command as I said or add your command in /etc/rc.local. – harirehm Mar 17 '15 at 15:17
  • Sorry @harirehm this is absolutely a strange behavior and should not be happening. – Joshua Grigonis Feb 28 '17 at 5:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.