Central Login For Your Masternode Herd!
Once you start getting more then a handful of servers it gets to be a bit of a pain logging into them to fix issues, updating etc etc. Here I will show you can use one of them and make a central SSH server where you can log into any of your servers quickly and easily.
Setting Up Your SSH Key
Login and generate a key, I will use ecdsa as the encryption algorithm for the key rather then the more well known rsa. Reason being rsa is getting pretty long in the tooth and quite possibly could be broken in the not so distant future.
ssh-keygen -t ecdsa -b 521
Name it some thing fun or practical, or both when asked “Enter file in which to save the key (/root/.ssh/id_ecdsa):” I named my key “central” so the name actually includes the path like so:
Enter file in which to save the key (/root/.ssh/id_ecdsa): /root/.ssh/central
Also I recommend you set a password on it, doesn’t have to be anything real complex. Something quick and easy to type that you will remember containing letters, numbers, and special characters. That way if some hacker managed to gain access he can’t run through all your servers causing mayhem without the password.
Now we will use ssh-copy to copy the public key over to the other servers. ssh-copy is fantastic as it copies it over and makes any other needed changes to make sure it is active, such as adding to known hosts.
ssh-copy-id -i /root/.ssh/central [email protected]
Now if all goes well you should be logged into the destination server, type “exit” to logout then try and login again with:
ssh -i /root/.ssh/central [email protected]
As an extra precaution I completely lock down the central server, all ports are closed and only access from my VPN IP is allowed. I also create a list of servers and an attached note in .list so I can simply do “cat .list” and get a list of all available servers or do “cat .list | grep domain.com to get a list for a certain domain.
Making things even more efficient. Create a config file in .ssh, this allows you to create an alias for each login and shorten them so for example “ssh -i /root/.ssh/central [email protected]” can become simply “ssh easypeasy”. This is how you can do it:
Add for example:
Save and exit, now give it a shot with “ssh easypeasy”, easy right?
Looking for a cheap but reliable Masternode VPS? Give us a shot 🙂