On Your MAC/LINUX CLIENT PC
mkdir -p ~/.ssh
chmod 700 ~/.ssh
# ssh-keygen produces two files. An empty pass phrase private key, 'piuser_rsa' and the public key 'piuser_rsa.pub'
ssh-keygen -b 4096 -t rsa -N '' -f .ssh/piuser_rsa
touch ~/.ssh/config
# Edit the ssh config file
vi ~/.ssh/config
# Insert a CONFIG entry in config for your particular server and save
Host controller pi0 pimanager
HostName 192.168.1.81
Port 22
User pi
IdentityFile ~/.ssh/piuser_rsa
Once completed (on server setup) - we can now ssh into the Pi server (192.168.1.81)with the command 'ssh pi0' or 'ssh pimanager' instead of ssh pi@192.168.1.81 -i .ssh/piuser_rsa
On Your Server Raspberry Pi (eg. 192.168.1.125)
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
vi ~/.ssh/authorized_keys
# Insert your Client's PUBLIC KEY (eg. 'piuser_rsa.pub') AT THE END OF THE 'authorized_keys' FILE AND SAVE
Debugging SSH daemon
Edit file /etc/ssh/sshd_config
# Logging
SyslogFacility AUTH
LogLevel DEBUG
Peek at logs on Daemon
tail -lf /var/log/auth.log
Debugging SSH client
ssh -vvvv pi@192.168.1.81
No comments:
Post a Comment