LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Redhat SSH Access (https://www.linuxquestions.org/questions/linux-newbie-8/redhat-ssh-access-4175534520/)

FlavioMiranda 02-19-2015 08:06 AM

Redhat SSH Access
 
Hello all,

I´m in trouble trying to access a server via ssh and root access but had no success so far.
The interesting thing is when I do /usr/sbin/sshd -d -p 2222 and try to connect on 2222 port I can do that. But if I try on port 22 no success.

following my sshd_conf. Any help will be appreciated:


# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes

# Accept locale-related environment variables
AcceptEnv LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server

pingu 02-19-2015 12:50 PM

First guess is that a firewall in front of the server forwards port 2222 to port 22 on your server, but blocks port 22.
Why is this a problem, just connect on port 2222?
(And a small tip, add "PermitRootLogin no" to the config.)

FlavioMiranda 02-20-2015 04:58 AM

Thanks for your response.

The problem is that I need to access the server first to redirect the port. This is not persistent. I will try change the parameter PermitRootLogin to 'no' although my understanding is exactly the contrary, I mean, yes would permit.

pingu 02-20-2015 05:01 AM

Maybe I should have been clearer: Setting "PermitRootLogin no" is a security measure, you should not allow root login. Always login as ordinary user, then switch to root using su or sudo.

pingu 02-20-2015 05:11 AM

So how is the firewall configuration? If there is a firewall between you and server, or are you directly connected?
Check iptables on the server (iptables -L)
Check open ports, for instance with "nmap 127.0.0.1" on the server, and from client computer using servers ip.


All times are GMT -5. The time now is 12:38 PM.