Creating a Shell Server
Contents |
Debian/Ubuntu
sudo apt-get install openssh-server
If you don't have the ssh client installed, you'll have to get that too.
sudo apt-get install ssh
Other
Find and install a package called sshd, ssh-server. or similar.
Usage
By default, the ssh daemon will open port 22 for users to connect to your computer. If you wish to change the port to something more accessible, (or something that won't get hit by scripts all day long), change the file /etc/ssh/sshd_config (this may be different on distros other than Debian based ones).
vim /etc/ssh/sshd_config
or
nano /etc/ssh/sshd_config
or whatever other editor you have
Change the line that says:
Port 22
To something more accessible, like:
Port 443
or
Port 37890 # if you really must :S
Next set
ServerKeyBits 768
to
ServerKeyBits 2056
for a bigger key making it harder to crack.
Also change
PermitRootLogin yes
to
PermitRootLogin no
WARNING: do NOT do the above setting on ubuntu, you will lose your login privileges as normal user (since you're a member of the admin group). This works fine on Debian and is highly recommended. All this does is blocks people from logging in with the root account. You can always su to root once your in though.
Set
PermitEmptyPasswords yes
to
PermitEmptyPasswords no
After all these settings you should restart the ssh daemon
On Ubuntu (for debian don't sudo use su)
sudo /etc/init.d/ssh restart
Allowing incoming connections
To allow the outside world to connect to your server:
1. Add an exception in your firewall rules to allow the port you have specified. (iptables, firestarter etc)
2. Forward the port in your router to your computer.
Finished.