Jul 16, 2012

0 SSH related problems



1. Permission denied
Run ssh with verbosity mode to see why authentication is failing.
ssh -v -v -v username@host
Look in the logs.
/var/log/auth.log
look for messages that contain "sshd

! In most cases password reset helps.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - -

 

2. Can't ssh to server from WAN.

1. Run ssh with verbosity mode to see why authentication is failing.
2. ssh -v -v -v username@host
3. Look in the logs.
4. /var/log/auth.log

Check in /etc/ssh/sshd_config
Look for line : sshd_config ListenAddress
If there’s an record of an defined IP address, then SSH will only accept connections from that IP address.
If IP address is correct, and you still can’t connect, then :
Put your server in DMZ zone in your router.

Maybe your router is blocking loopback connections. It’s worth to check that.
Add port forward to your router’s configuration (Outside IP -> LAN IP) by adding option for 22 port.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  - - - - - - - - - - - - - - - - - - - - -

 

ssh: connect to host server port 22: Operation timed out
Check for :

/etc/init.d/sshd start
/etc/init.d/sshd status
or
sudo service ssh status
sudo service ssh start|restart|stop

It’s quite rare, but you may want to call to your ISP office , and ask if they are blocking port 22.
If so , then you just change SSH listening port to some, what is allowed.
You can do that in : /etc/ssh/sshd_config
After changing your sshd_config (not ssh_config) on the server you must restart sshd. Reboot or :

pkill -SIGHUP sshd (this makes SSHD to recheck it’s config)

More : confirm which port is being listened on,
sudo netstat -lntp
Maybe firewall is blocking port :
sudo iptables –L

! Usually in 90% cases, by changing port and restarting SSHD service you will get shell access.

0 comments :

Post a Comment

Comment: