You are not logged in.

#1 2009-08-04 20:43:51

DevonSix
Member
Registered: 2008-06-09
Posts: 25

Setting up a ssh server.

Hi guys.

I've got a probably easy question. I want to set up a shell server on my PC but I completly forgot how to do it. Like, I need to run sshd but how to limit programs/stuff for desired users etc? I googled and found nothing sad.

Thanks,
Devon.

Offline

#2 2009-08-04 21:06:02

marxav
Member
From: Gatineau, PQ, Canada
Registered: 2006-09-24
Posts: 386

Re: Setting up a ssh server.

How about checking the wiki http://wiki.archlinux.org/index.php/SSH
There was also a good article in Arch Magazine No2 I think....

Offline

#3 2009-08-05 15:49:33

DevonSix
Member
Registered: 2008-06-09
Posts: 25

Re: Setting up a ssh server.

Thank you smile

Offline

#4 2009-08-05 23:24:45

DevonSix
Member
Registered: 2008-06-09
Posts: 25

Re: Setting up a ssh server.

Well, I set it up but not I've got 'Connection refused' each time I try to connect. Although, 'ssh -l root localhost' works fine on the machine.

My ssh config:

#    $OpenBSD: ssh_config,v 1.25 2009/02/17 01:28:32 djm Exp $

# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.

# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

Host *
   ForwardAgent no
   ForwardX11 no
   RhostsRSAAuthentication no
   RSAAuthentication yes
   PasswordAuthentication yes
   HostbasedAuthentication no
   GSSAPIAuthentication no
   GSSAPIDelegateCredentials no
   BatchMode no
   CheckHostIP no
   AddressFamily any
   ConnectTimeout 0
   StrictHostKeyChecking ask
   IdentityFile ~/.ssh/identity
   IdentityFile ~/.ssh/id_rsa
   IdentityFile ~/.ssh/id_dsa
   Port 22
   Protocol 2
   Cipher 3des
   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
   EscapeChar ~
   Tunnel no
   TunnelDevice any:any
   PermitLocalCommand no
   VisualHostKey no
HashKnownHosts yes
StrictHostKeyChecking ask

sshd config:

#    $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.

Port 22
#AddressFamily any
ListenAddress 127.0.0.1
#ListenAddress ::

# Disable legacy (protocol version 1) support in the server for new
# installations. In future the default will change to require explicit
# activation of protocol 1
Protocol 2

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 1024

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
LogLevel INFO

# Authentication:

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#MaxSessions 10

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

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

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
PermitEmptyPasswords no

# Change to no to disable s/key passwords
ChallengeResponseAuthentication no

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

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# 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

AllowAgentForwarding yes
AllowTcpForwarding yes
GatewayPorts no
X11Forwarding no
X11DisplayOffset 10
X11UseLocalhost yes
PrintMotd yes
PrintLastLog yes
TCPKeepAlive yes
UseLogin no
UsePrivilegeSeparation yes
PermitUserEnvironment no
Compression delayed
ClientAliveInterval 0
ClientAliveCountMax 3
UseDNS yes
PidFile /var/run/sshd.pid
MaxStartups 10
PermitTunnel no
ChrootDirectory none

# no default banner path
Banner /etc/issue

# override default of no subsystems
Subsystem    sftp    /usr/lib/ssh/sftp-server

# Example of overriding settings on a per-user basis
#Match User anoncvs
#    X11Forwarding no
#    AllowTcpForwarding no
#    ForceCommand cvs server

Thanks,
Dev

Offline

#5 2009-08-05 23:29:05

jowilkin
Member
Registered: 2009-05-07
Posts: 243

Re: Setting up a ssh server.

What's in your /etc/hosts.allow and /etc/hosts.deny files?

Have you tried with default config?  Does that work?

Offline

#6 2009-08-05 23:41:04

sand_man
Member
From: Australia
Registered: 2008-06-10
Posts: 2,164

Re: Setting up a ssh server.

Also remember if you are using a router you will need to forward the appropriate port.


neutral

Offline

#7 2009-08-06 05:50:04

thisllub
Member
From: Northern NSW Australia
Registered: 2007-12-28
Posts: 231

Re: Setting up a ssh server.

jowilkin wrote:

What's in your /etc/hosts.allow and /etc/hosts.deny files?

Have you tried with default config?  Does that work?

That's where my money is riding.

Offline

#8 2009-08-06 07:29:25

jelly
Administrator
From: /dev/null
Registered: 2008-06-10
Posts: 714

Re: Setting up a ssh server.

Some ssh tips:
-don't allow root login
-use keys
-only allow a certain range/i'p's to connect
-run it on a different port
-you might want to setup iptables against DDosing

I might be a bit of a security freak , but some options are so simple and easy to setup . Running on another port wouldnt save you from people how are using nmap or so but it still blocks the script kiddies / teenagers how are just pounding the 22/23 ports wink

Offline

#9 2009-08-06 09:38:40

DevonSix
Member
Registered: 2008-06-09
Posts: 25

Re: Setting up a ssh server.

hosts.allow

sshd: ALL

hosts.deny

ALL: ALL: DENY

Offline

Board footer

Powered by FluxBB