SSH: Connection Refused - Ubuntu 12.04
I'm setting up an SSH server on my home computer. I'm kind of a Linux noob (I've been using Ubuntu since Febuary or so, meaning I'm not terribly good at everything, but I know some basic stuff to try.
So, if I try to connect to the server through my laptop (also running Ubuntu 12.04), I get this error: Code:
$ ssh 192.168.1.7 -vvv Code:
$ ssh localhost -vvv Code:
ps -ef | grep sshd Thanks. |
Quote:
|
Ok well there are two ssh config files.. ssh_config is the [I]client/I] configuration file and your sshd_config is the daemon or server configuration file. So ssh is running but your looking at a connectivity issue.
Take a look and see if your server is listening on port 22: Code:
netstat -anp | grep :22 Code:
ps aux | grep sshd | grep root | grep -v "grep" |
Quote:
You should check with the /etc/init.d/ script as it has the best functionality built in to check. The ps command should give the /usr/sbin/sshd process running but the init script would confirm that it is not running. |
This may be a dumb question, but is it installed? openssh-server?
|
Your SSHD (server) is not running. If it were running you would see something like the following:
Code:
sudo ps -ef | grep sshd Code:
sudo ssh status Code:
sudo ssh start |
Thanks for all of the replies.
Quote:
Quote:
Code:
-bash: /etc/init.d/sshd: No such file or directory Quote:
Code:
ssh: Could not resolve hostname stop: Name or service not known Code:
# start ssh Code:
# stop ssh |
Quote:
Code:
sudo service ssh status and service ssh start Quote:
|
Try to start ssh with this command:
Code:
/usr/sbin/sshd -ddd |
Quote:
Code:
status: Env must be KEY=VALUE pairs Code:
Rather than invoking init scripts through /etc/init.d, use the service(8) Quote:
Code:
$ /usr/sbin/sshd -ddd Code:
debug2: load_server_config: filename /etc/ssh/sshd_config |
Looks like you are trying to run sshd as a normal user. You will have to start it as root for it to bind to port 22.
|
Quote:
In any case, you have confirmed that it is not running and your log files are indicating a problem with your configuration file, which appears to be caused by options you have added. Quote:
One other thing to mention, you think it is running, you can verify that the process is active and listening using the netstat command: Code:
sudo netsat -pane | grep 22 Code:
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 0 3707 1072/sshd |
Interesting... I'll have to check that out when I get access to the computer again.
|
Hi
check the sshd.pid permission .It may leads ssh startup error #stat /var/run/sshd.pid File: `/var/run/sshd.pid' Size: 4 Blocks: 8 IO Block: 4096 regular file Device: 11h/17d Inode: 3979 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2012-06-29 10:53:36.982798375 +0530 Modify: 2012-06-29 10:53:36.982798375 +0530 Change: 2012-06-29 10:53:36.982798375 +0530 |
I believe your server didn't work by these bad configuration options. And next "Permission denied" errors were, because you trying to run server on non root account, as other noticed. Check if it still doesn't start after reboot by ps or netstat. If not then once again show output of "/usr/sbin/sshd -ddd".
By the way these options "ForwardAgent" and "ForwardX11" are for ssh client configuration (/etc/ssh/ssh_config), not server. For server there is "X11Forwarding" option. |
All times are GMT -5. The time now is 11:11 PM. |