LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-24-2012, 04:21 AM   #16
Arjun
Member
 
Registered: Feb 2011
Posts: 120
Blog Entries: 2

Original Poster
Rep: Reputation: 0

Quote:
Originally Posted by xtpeqii View Post
COULD YOU provide us the following content:

content in /etc/ssh/sshd_config



THOUGH YOU'D BETTER ASK SOMEONE WHO USE FEDORA in case of some difference between multiple distros.
Here is the information you are asking for in /etc/ssh/sshd_config

Code:
# Package generated configuration file
# See the sshd_config(5) manpage for details

# What ports, IPs and protocols we listen for
Port 22
# Use these options to restrict which interfaces/protocols sshd will bind to
#ListenAddress ::
#ListenAddress 0.0.0.0
Protocol 2
# HostKeys for protocol version 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
#Privilege Separation is turned on for security
UsePrivilegeSeparation yes

# Lifetime and size of ephemeral version 1 server key
KeyRegenerationInterval 3600
ServerKeyBits 768

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin yes
StrictModes yes

RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile	%h/.ssh/authorized_keys

# Don't read the user's ~/.rhosts and ~/.shosts files
IgnoreRhosts yes
# For this to work you will also need host keys in /etc/ssh_known_hosts
RhostsRSAAuthentication no
# similar for protocol version 2
HostbasedAuthentication no
# Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication
#IgnoreUserKnownHosts yes

# To enable empty passwords, change to yes (NOT RECOMMENDED)
PermitEmptyPasswords no

# Change to yes to enable challenge-response passwords (beware issues with
# some PAM modules and threads)
ChallengeResponseAuthentication no

# Change to no to disable tunnelled clear text passwords
#PasswordAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosGetAFSToken no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

X11Forwarding yes
X11DisplayOffset 10
PrintMotd no
PrintLastLog yes
TCPKeepAlive yes
#UseLogin no

#MaxStartups 10:30:60
#Banner /etc/issue.net

# Allow client to pass locale environment variables
AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication and
# PasswordAuthentication.  Depending on your PAM configuration,
# PAM authentication via ChallengeResponseAuthentication may bypass
# the setting of "PermitRootLogin without-password".
# If you just want the PAM account and session checks to run without
# PAM authentication, then enable this but set PasswordAuthentication
# and ChallengeResponseAuthentication to 'no'.
UsePAM yes
UseDNS no
 
Old 07-24-2012, 05:00 AM   #17
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
Is the ssh daemon running?

try the command in bold blue; you should see something like the first line
Code:
wim@webserver:~$ ps -ef |grep sshd
root      3033     1  0  2011 ?        00:00:00 /usr/sbin/sshd
root      6987  3033  0 10:49 ?        00:00:00 sshd: wim [priv]
wim       6989  6987  0 10:49 ?        00:00:00 sshd: wim@pts/0
wim       7004  6990  0 10:50 pts/0    00:00:00 grep sshd
wim@webserver:~$
Or the command posted by chrism01 in post #11 (run as root); again you should see something like the first line that indicates that something (ssh daemon) is listening on port 22
Code:
root@webserver:~# netstat -tanp |grep ssh
tcp6       0      0 :::22                   :::*                    LISTEN     3033/sshd
tcp6       0     52 ::ffff:172.31.208.76:22 ::ffff:172.31.208:59466 ESTABLISHED6987/sshd: wim [pri
root@webserver:~#
 
Old 07-25-2012, 08:03 AM   #18
Arjun
Member
 
Registered: Feb 2011
Posts: 120
Blog Entries: 2

Original Poster
Rep: Reputation: 0
Yaa bro.

It is running

I have checked it
 
Old 07-25-2012, 08:49 AM   #19
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
I overlooked this in your earlier post #12

Code:
ssh root@127.0.0.1
Code:
Read from socket failed: Connection reset by peer
Try to login as a normal user instead of root. I see that you did allow it in the config but maybe there is something else that blocks it (maybe you did not restart the ssh server after the change?). And in my opinion a security risk.

Once that works, you can use su or sudo to gain root access once your in the system.

Last edited by Wim Sturkenboom; 07-25-2012 at 09:29 AM.
 
Old 07-25-2012, 09:04 PM   #20
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
Code:
PermitRootLogin yes
This is definitely a security risk and it is heavily recommended to NOT allow root over ssh.
You might also need to check /etc/hosts.allow, /etc/hosts.deny.
The other thing that can be an issue is the firewall; you can use
Code:
iptables -nvL

# Or

cat /etc/sysconfig/iptables  # RHEL/Fedora
to check
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssh: connection to host port: 22: Connection timed out lost connection cucolin@ Linux - Server 4 11-22-2011 07:15 AM
ssh connection forces password change, then closes connection loadedmind Linux - Newbie 2 02-16-2011 02:24 PM
LXer: ssh-xfer: Quickly grabbing files over an existing SSH connection LXer Syndicated Linux News 0 08-08-2008 04:11 PM
ssh connection refused - trying to set up ssh server at home openSauce Linux - Server 10 10-18-2007 05:38 PM
Connection to ssh... wtfn00b Linux - Newbie 2 02-01-2006 11:09 AM


All times are GMT -5. The time now is 04:47 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration