Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 28255  / 3 Years ago, sun, october 24, 2021, 3:34:27

I recently got Ubuntu 12.04 Precise, got it up and running with some MediaWiki software, static IP on the box and router and was able to access the main page even from a cell phone. Everything seemed great...



Then I wanted to finally get rid of the monitor and keyboard and login remotely via SSH.



I installed openssh-server, let everything point to port 22 for a test run and installed putty on my Windows XP machine. I got a connection refused. Went back and started checking the Ubuntu install itself... (I'm under root from this point on)



$ sudo -s

$ service ssh status
ssh stop/waiting

$ service ssh start
ssh start/running, process 2212

$ service ssh status
ssh stop/waiting


Apparently ssh has stopped or is waiting for something....



$ ssh localhost
ssh: connect to host localhost port 22: Connection refused


I can't even connect to myself... I checked ufw (firewall) to see if port 22 is doing alright...



$ sudo ufw status
Status: active
To Action From
22 ALLOW Anywhere
22/tcp ALLOW Anywhere
22 ALLOW Anywhere (v6)
22/tcp ALLOW Anywhere (v6)


sshd_config shows only Port 22



Is ssh not using the right IP address at all? I just don't get what I did wrong here. When this is up and running I will def change the port number, but for now, I don't want to mess with the default install too much until a test run with putty is successful.



Edit:



Here are my sshd_config file and my ssh_config file.



The command /usr/sbin/sshd -p 22 -D -d -e returns:




/etc/ssh/sshd_config line 159: Subsystem 'sftp' already defined.




Edit:
@phoibus
moving the sshd_config file and reinstalling did the trick!



service ssh status



the above command shows that ssh is now running and I am now able to log in from my windows xp computer remotely via putty. Thanks so much! I can now use my monitor for other things!


More From » ssh

 Answers
7

You got duplicate sections in your /etc/ssh/sshd_config file.



Rename your sshd_config file



sudo mv /etc/ssh/sshd_config /etc/ssh/sshd_config.old


and reinstall openssh-server to get the original file:



sudo apt-get install --reinstall openssh-server


See if it works now.


[#34927] Sunday, October 24, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brellked

Total Points: 63
Total Questions: 107
Total Answers: 104

Location: Morocco
Member since Fri, May 22, 2020
4 Years ago
;