LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > *BSD
User Name
Password
*BSD This forum is for the discussion of all BSD variants.
FreeBSD, OpenBSD, NetBSD, etc.

Notices


Reply
  Search this Thread
Old 03-02-2006, 08:36 PM   #1
rickylim
Member
 
Registered: Jan 2006
Location: Malaysia
Distribution: RedHat & FreeBSD
Posts: 68

Rep: Reputation: 15
ssh login


Hi everyone,

i am taking over one of the freebsd 4.9 server running as mail server and i am very new to freebsd.

i have few questions related to ssh. PLease advice.

1st questions:-
how can i check what port is ssh using in that server(running on command interface).

2nd questions:-
how do i check whether the ssh port is open and not blocked so that i can use it in that server.

3rd questions:-
can ssh allow only specific ip address to ssh in to the server.

4th questions:-
i am running win xp, is it possible to ssh to the freeBSD server.

Thanks for your attention.

rgds.
Lim
 
Old 03-02-2006, 08:51 PM   #2
JackSmith
Member
 
Registered: Feb 2005
Location: US
Distribution: Slackware
Posts: 30

Rep: Reputation: 15
1st
SSH usually runs on port 22. As far as determining what port it's running under, It's probably not the best method, but I always just use nmap. ie 'nmap localhost'. If you have some IDS in place this will likely make it unhappy though.

3rd
I'm not sure whether SSH itself allows that kind of granularity, but you can easily solve the issue using a firewall. IPFilter is the standard firewall for freebsd if I remember right.

4th
yes! you just need an SSH client for XP, you can find one here:
http://www.colorado.edu/its/MSG/win/...hellClient.exe

Hope this helps a little, good luck.
 
Old 03-02-2006, 08:55 PM   #3
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Hope this helps (Slackware here, not BSD)...

For your first question (port number), can you try the following:
Code:
ssh -v localhost
And look for a line like:
Code:
debug1: Connecting to localhost [127.0.0.1] port 22.
For your second question, try the following:
Code:
netstat --inet -a | grep 'ssh'
An output like the following means that it is listening on all interfaces:
Code:
tcp        0      0 *:ssh                   *:*                     LISTEN
For your third question, depending on how ssh was compiled, it may use hosts.allow/hosts.deny. Alternatively, you can configure your firewall rules to limit the hosts.

For your fourth question, yes there are windows based ssh clients (putty from http://www.chiark.greenend.org.uk/~sgtatham/putty/ is just one).
 
Old 03-02-2006, 09:00 PM   #4
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
1) `sockstat | grep sshd`

That will print out where sshd is listening


2) I would use nmap from an external computer or a website which does such things (portmapping). If it is blocked... look in your /etc/rc.conf to see if you have a firewall type described and then you can find that and change it to permit access.


3) Edit /etc/ssh/sshd_config and add
Code:
AllowUsers *@10.0.0.1
Replace the ip with the one you want (you can add more by seperating them with spaces and wild cards should work as well). With this done, only those users and hosts listed here will be able to log in. It's probably best to use:
Code:
AllowUsers username@ip.add.re.ss
As that will allow only you, and only from that ip.

Here is the relevant section of the man page.
Code:
     AllowUsers
             This keyword can be followed by a list of user name patterns,
             separated by spaces.  If specified, login is allowed only for
             user names that match one of the patterns.  `*' and `?' can be
             used as wildcards in the patterns.  Only user names are valid; a
             numerical user ID is not recognized.  By default, login is
             allowed for all users.  If the pattern takes the form USER@HOST
             then USER and HOST are separately checked, restricting logins to
             particular users from particular hosts.
 
Old 03-02-2006, 09:04 PM   #5
rickylim
Member
 
Registered: Jan 2006
Location: Malaysia
Distribution: RedHat & FreeBSD
Posts: 68

Original Poster
Rep: Reputation: 15
Thanks guy!.. you guys are great.

As for the firewall setting, i will check with the Person-In-Charge.

Bravo.. :-) Thanks!!!

 
Old 03-02-2006, 09:07 PM   #6
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Debian, FreeBSD
Posts: 1,450

Rep: Reputation: 48
Quote:
Originally Posted by gilead
Hope this helps (Slackware here, not BSD)...

For your first question (port number), can you try the following:
Code:
ssh -v localhost
And look for a line like:
Code:
debug1: Connecting to localhost [127.0.0.1] port 22.
How would this work if sshd was running on port 23005 (for example)? It wouldn't. This is just the verbose listing but it does provide the port information if the port is the standard one (which we already know is 22).

Quote:
For your second question, try the following:
Code:
netstat --inet -a | grep 'ssh'
An output like the following means that it is listening on all interfaces:
Code:
tcp        0      0 *:ssh                   *:*                     LISTEN
These options aren't valid. And, while netstat can be used... this would also only work with the standard port. The *:ssh uses /etc/services to look up the number... if sshd was listening on 666 for example, it would show up as *:doom
 
Old 03-02-2006, 09:45 PM   #7
gilead
Senior Member
 
Registered: Dec 2005
Location: Brisbane, Australia
Distribution: Slackware64 14.0
Posts: 4,141

Rep: Reputation: 168Reputation: 168
Yeah, you're right - at best it would only confirm whether the standard values were being used. My apologies to rickylim if this caused any confusion.
 
Old 04-03-2006, 02:55 AM   #8
danielanson
Member
 
Registered: May 2005
Location: San Antonio, TX
Distribution: OpenBSD 3.7
Posts: 76

Rep: Reputation: 15
1. cat /etc/ssh/sshd_config | grep -i port (look for an uncommented line. 22 is default)
2. telnet serveraddress port (from an outside machine)
3. yes
4. putty or secureshell

-=SuperChicken=-
 
  


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
about ssh login... jsnch Linux - Networking 1 07-05-2005 11:39 PM
SSH Login | Need help !! xedios Linux - Software 0 12-21-2004 12:16 PM
ftp login -- ssh no login waffe Linux - General 4 12-27-2003 12:42 AM
SSH Login Again gsibble Linux - Newbie 13 08-11-2003 03:15 AM
SSH Login gsibble Linux - Newbie 4 08-10-2003 04:54 AM

LinuxQuestions.org > Forums > Other *NIX Forums > *BSD

All times are GMT -5. The time now is 06:07 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
Open Source Consulting | Domain Registration