Generating Your SSH Keys
SSH Keys are very important. Without them you won’t be able to connect to your server. To start making your keys, create the folder in which your newly-generated key will live.
mkdir ~/.ssh
After making the folder, change its permissions.
chmod 700 ~/.ssh
Finally, generate your key. Keep in mind that SSH is only as safe as the password you set up. If you enter a weak password, one that can be guessed easily, you’ll be open to attacks. Instead, try to generate a secure, memorable password.
ssh-keygen -t rsa
Want to connect over LAN? It’s easy! Just open a terminal window and figure out the IP address of the machine with the SSH server running. This can be done simply by running the ifconfig command.
Once you’ve determined the IP address of the machine, you’ll be able to log in. Just go back to the machine you’re trying to log in with and enter this command:
ssh username@ip.address.here
Note: change the “username” to the user name of the SSH server.
After setting up port forwarding, you’ll need to determine the IP address of the machine you’re trying to SSH to. The easiest way to figure this out is to head over to ipchicken.com. They’ll tell you your Internet IP address.
Once you’ve gotten your Internet IP address, you’ll be able to log in. Just go to your terminal and enter the following:
ssh username@ip.address.here
From there you’ll be prompted to enter the SSH password. Enter it, and soon after you’ll be logged into your machine over the Internet via SSH.
Congratulations, you have completed setting up SSH in Ubuntu; you can now proceed to secure your SSH server.
mkdir ~/.ssh
After making the folder, change its permissions.
chmod 700 ~/.ssh
Finally, generate your key. Keep in mind that SSH is only as safe as the password you set up. If you enter a weak password, one that can be guessed easily, you’ll be open to attacks. Instead, try to generate a secure, memorable password.
ssh-keygen -t rsa
Connecting Over LAN
Want to connect over LAN? It’s easy! Just open a terminal window and figure out the IP address of the machine with the SSH server running. This can be done simply by running the ifconfig command.
Once you’ve determined the IP address of the machine, you’ll be able to log in. Just go back to the machine you’re trying to log in with and enter this command:
ssh username@ip.address.here
Note: change the “username” to the user name of the SSH server.
From there you’ll be prompted to enter your password. Do so. Soon after you’ll be logged in over LAN via SSH.
Connecting to SSH Server Over the Internet
Along with connecting over LAN, connecting via SSH over the Internet is possible too. It just requires a bit of network savvy to set up. If you want to do this, you’ll need to set up port forwarding for your router.
Since every router out there is vastly different, you’ll need to do your own research on this topic. Just make sure you forward port 22 to the Internet from whatever machine is set up to use the SSH server, and you’ll be set.
Once you’ve gotten your Internet IP address, you’ll be able to log in. Just go to your terminal and enter the following:
ssh username@ip.address.here
From there you’ll be prompted to enter the SSH password. Enter it, and soon after you’ll be logged into your machine over the Internet via SSH.
Congratulations, you have completed setting up SSH in Ubuntu; you can now proceed to secure your SSH server.
EmoticonEmoticon