четверг, 4 февраля 2010 г.

Установка и настройка SSH сервера на Ubuntu

To install openssh server type following command:
$ sudo apt-get install openssh-server
Make sure openssh is running:
$ netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp6       0      0 :::22                   :::*                    LISTEN     3458/sshd
Now we will tight openssh security. First change default 22 port to something else like 512. This will avoid automated tools login into your box:

$ sudo su -
# vi /etc/ssh/sshd_config

Find line that read as follows:
Port 22
Replace port 22 with 512:
Port 512
Save and close the file. Restart sshd:
# /etc/init.d/ssh restartOutput:
 * Restarting OpenBSD Secure Shell server... 
Finally make sure you open port 512 using iptables. Type the following command to list current firewall rules:
$ sudo iptables -L -n
Chain INPUT (policy DROP)
target     prot opt source               destination
ACCEPT     all  --  
ACCEPT     all  --             state RELATED,ESTABLISHED
ACCEPT     tcp  --             tcp dpts:6881:6882
ACCEPT     tcp  --             tcp dpt:443
ACCEPT     udp  --             udp dpt:514
ACCEPT     all  --
ACCEPT     all  --
ACCEPT     all  --
LOG        all  --             LOG flags 0 level 4
DROP       all  --           

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination       

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
ACCEPT     all  --  
Use GUI program such as firestarter to manage and open port 22 (ssh port).
$ sudo firestarter &

Комментариев нет:

Отправить комментарий