LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 04-18-2016, 09:22 PM   #1
Manuel-H
Member
 
Registered: Apr 2003
Location: Singapore
Distribution: Slackware32/64, Ubuntu, Fedora, RHEL
Posts: 138

Rep: Reputation: 15
Chroot SSH login - Auto Disconnect


Hi all,

I have setup a working chroot SSH login on a slackware 12.2 (32bit).
previous source: (think the site is down now)
http://www.tjw.org/chroot-login-HOWTO/

I am trying to setup the same on a newer Slackware 14.0 (64bits)
I copy the lib to lib64 for 64 bits library.
I also did "ldd /bin/bash" (ls/cp/etc) and copy all the libraries.
My authentication was completed but then I got auto-disconnected.
There is no .profile or logout on my login script.

When I use Bitvise, the messages I got was:
Attempting password authentication.
Authentication completed.
Terminal channel opened.
Terminal channel: Received exit code 1.
Terminal channel closed by server.

On my secure log, it only show the connection, no error.
On my messages log, it only show the normal connection.
sshd[30312]: Accepted password for <user> from <ipaddress> port 51097 ssh2

Did I missed something between 12.2/14.0 and 32/64 bits?

Appreciate any guidance or help.
Thanks.

Last edited by Manuel-H; 04-18-2016 at 09:57 PM.
 
Old 04-19-2016, 02:12 PM   #2
jrigg
LQ Newbie
 
Registered: Jan 2016
Posts: 18

Rep: Reputation: Disabled
The link you posted seems to be offline.

Have you checked permissions on the chroot directory containing your home directory? The chroot dir should be owned by root and be non-writable by the chrooted user (if it is writable by the user sshd will disconnect).

What messages do you see if you run sshd in debug mode (ie. with -d option)?
 
Old 04-19-2016, 04:06 PM   #3
rob.rice
Senior Member
 
Registered: Apr 2004
Distribution: slack what ever
Posts: 1,076

Rep: Reputation: 205Reputation: 205Reputation: 205
have you checked the /etc/ssh/sshd.conf file on the computer your trying to log on to
root logins are disallowed by default
uncoment this line "#PermitRootLogin yes"to enable root login
in /etc/ssh/sshd.conf

Last edited by rob.rice; 04-19-2016 at 04:17 PM.
 
Old 04-20-2016, 06:10 AM   #4
jrigg
LQ Newbie
 
Registered: Jan 2016
Posts: 18

Rep: Reputation: Disabled
Quote:
Originally Posted by rob.rice View Post
have you checked the /etc/ssh/sshd.conf file on the computer your trying to log on to
root logins are disallowed by default
uncoment this line "#PermitRootLogin yes"to enable root login
in /etc/ssh/sshd.conf
The initial authentication appears to be successful, which wouldn't happen if logins were disallowed in sshd_config, but then it is disconnected. That's why I suggested looking at messages from sshd -d.

"PermitRootLogin yes" is inadvisable on an internet facing server. It's safer to use "PermitRootLogin no" which allows user logins and then su into root after logging in.

Last edited by jrigg; 04-20-2016 at 01:57 PM.
 
Old 04-20-2016, 07:48 AM   #5
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
Here is the most recent copy of the document you referred to:

chroot-login-HOWTO

archive.org ftw. I checked every date up to March 11 2007 for year 2007. There were many http 404 errors on later dates.
 
Old 04-20-2016, 01:53 PM   #6
jrigg
LQ Newbie
 
Registered: Jan 2016
Posts: 18

Rep: Reputation: Disabled
Quote:
Originally Posted by mralk3 View Post
Here is the most recent copy of the document you referred to:

chroot-login-HOWTO
That article is dated 2001. OpenSSH acquired built-in chroot ability around 2008 with the 4.9p1 release (`man sshd_config' for details).

Last edited by jrigg; 04-20-2016 at 02:02 PM.
 
Old 04-21-2016, 12:35 PM   #7
rob.rice
Senior Member
 
Registered: Apr 2004
Distribution: slack what ever
Posts: 1,076

Rep: Reputation: 205Reputation: 205Reputation: 205
Quote:
Originally Posted by jrigg View Post
The initial authentication appears to be successful, which wouldn't happen if logins were disallowed in sshd_config, but then it is disconnected. That's why I suggested looking at messages from sshd -d.

"PermitRootLogin yes" is inadvisable on an internet facing server. It's safer to use "PermitRootLogin no" which allows user logins and then su into root after logging in.
logins and "root logins " are not the same thing
an su root is the same thing as a root login
su logs the user back in as root

here is another HOW TO
http://kegel.com/crosstool/current/d...gin-howto.html

Last edited by rob.rice; 04-21-2016 at 12:50 PM.
 
Old 04-22-2016, 08:56 AM   #8
jrigg
LQ Newbie
 
Registered: Jan 2016
Posts: 18

Rep: Reputation: Disabled
Quote:
Originally Posted by rob.rice View Post
su logs the user back in as root
Yes. That's the idea. But it doesn't allow root logins directly from the internet, only from an already logged-in user. The point is to disallow automated logins from crackers trying to login to root@yourhostname using brute force methods. If you only allow password logins from non-root users and choose an obscure user name it adds another layer of difficulty for attackers as they can't brute-force a password for a username they can't guess. Obviously this won't help if your username is "admin" or something equally easy to guess.

If you also limit the number of incorrect login attempts with iptables rules it makes it difficult to brute force the SSH server. I've been running sshd on an internet facing server for about 8 years using the methods I've described, with no break-ins (but many attempts, mostly trying to login as root).

Last edited by jrigg; 04-22-2016 at 12:20 PM.
 
  


Reply



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
[SOLVED] ssh-keygen for auto ssh login not working R00ts Linux - Software 26 09-23-2012 01:40 PM
ssh auto login script zerocool22 Linux - Server 4 05-13-2008 09:43 PM
Chroot ssh login problem guillermo Linux - Security 2 11-02-2007 08:12 AM
How can I auto login to ssh server? sailershen Linux - General 1 04-17-2006 01:04 AM
ssh or telent auto login prashant_1012 Programming 1 11-22-2005 01:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:40 AM.

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