Debian Environment Variables
I began having problems on a new Debian 7 server after changing BASH Environment variables for color using some legacy files taken from an Ubuntu 12.04 server.
First Noticeable Problem
BASH scripts executed from a user as sudo = the results belonging to root. In other words, a backup script executed by troy thus:
caused the backup to be owned by root, and saved in /root/
Looking for a solution by searching “BASH environment variables” was a deadend.
Then Second Problem
The login using ssh keys stopped working
Server host key: ECDSA 96:90:66:d1:ed:d1:ad:83:1f:54 debug1: Host '[host.seleads.com]' is known and matches the ECDSA host key. debug1: Found key in /home/user/.ssh/known_hosts:13 debug1: ssh_ecdsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password
Third Problem | services stopped working
troy@host:~$ sudo service ssh status
ssh: unrecognized service
This Fixed the services problem
sudo chmod +x /etc/init.d/*
But the login using keys = this Error was in auth.log
sshd Authentication refused: bad ownership or modes for directory
This Fixed that problem
chmod 755 /home
chmod 755 /home/user
chmod go-w ~/
chmod 755 ~/.ssh
chmod 644 ~/.ssh/authorized_keys
And then I lived happily ever after – all above problems were resolved.
However, I noticed that it is recommended thus:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
So I refreshed and voila, everything was still working fine. I cant say why Debian 7 required that circuitous route to fix (the problem ? ).