PDA

View Full Version : SSH in debian/ubuntu safe login



me1960
05-06-09, 08:49
SSH in debian/ubuntu safe login

'' Changing the port sshd listens on is a simple process and some times is needed to prevent hacking.. it's just a matter of updating your sshd_config file and then reloading the new configuration.

Use the procedure below to change the port that sshd is listening on to for example 21000 :

Warning: Incorrectly following this procedure may render your server unreachable through SSH.
1. From your terminal session, edit /etc/ssh/sshd_config

2. Look for the following line:

#Port 22

3. Change the line so it looks like this:

Port 21000

4. Save and close the file

5. Load the new configuration by using the service command

/etc/init.d/sshd restart

Note: you may immediately lose connectivity to your server on the open ssh session you are currently running.


6. Test the connection

$ ssh username@myhostnaname.com -p 21000

If you're using PuTTy on Windows, you can specify the port number in the profile for you connection and then re-save the profile using the new port.

Also you can specify who can login via ssh port ...
Just edit this line :
AllowUsers xxxxx ...so only user xxxxx can login with ssh to your pc..

For more safety you can prevent root login to ssh...Just edit this line as:
PermitRootLogin no

So now you login as user and after with a su command you are the root..

At last you can edit the time you have for writing the password with this line:
LoginGraceTime 45 ... don't prefere much time...I think after this you made a small step to login to your server with the safest way... ''

skkip3r
05-06-09, 10:13
Schimbarea portului nu inseamna ca ai rezolvat problema, e doar o chestiune de timp (nmap rezolva aceasta problema).

In schimb nu trebuie sa iti faci griji in privinta SSH. Diferenta intre SSH si telnet este ca SSH (Secure Shell) nu poate fi acultat. De ce? Pentru ca, pentru fiecare computer in parte, care face rlogin prin acest protocol, se formeaza un RSA (amprenta - denumire care vine de la Rivest, Shamir si Adelman, dezvoltatorii acestui protocol).

Deci, informatiile trimise - primite prin acest protocol vor putea fi interceptate numai daca acel utilizator care "asculta" portul SSH are si acea amprenta.