Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > ISPConfig 2 > General

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 17th January 2007, 22:28
PermaNoob PermaNoob is offline
Senior Member
 
Join Date: Jan 2007
Posts: 159
Thanks: 11
Thanked 4 Times in 4 Posts
Default Prevent ssh access view of other directories?

Is there a way to prevent clients who login with ssh clients like winscp from seeing the contents of directories other than their own?

I know I have clients who wouldn't be too happy with other people knowing what's in their directories.

I've been testing out my new server with ISPconfig before I move any clients over, and this could be a problem.
Reply With Quote
Sponsored Links
  #2  
Old 18th January 2007, 08:04
till till is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 31,892
Thanks: 693
Thanked 4,188 Times in 3,205 Posts
Default

You must use chrooted SSH:

http://www.howtoforge.com/forums/showthread.php?t=8677

or search the forums for:

chroot ssh
__________________
Till Brehm
--
Get ISPConfig support and the ISPConfig 3 manual from ispconfig.org.
Reply With Quote
  #3  
Old 18th January 2007, 11:37
PermaNoob PermaNoob is offline
Senior Member
 
Join Date: Jan 2007
Posts: 159
Thanks: 11
Thanked 4 Times in 4 Posts
Default

If I do this, is it going to screw up my ISPconfig installation? :

1 Install The Newest Zlib Version
Because there was a security hole in zlib-1.2.2 about which the chrooted SSH will complain when we try to compile it, we install the newest zlib version right now:

cd /tmp
wget http://www.zlib.net/zlib-1.2.3.tar.gz
tar xvfz zlib-1.2.3.tar.gz
cd zlib-1.2.3
make clean
./configure -s
make
make install


2 Install The Chrooted SSH

This is quite easy. We download the patched OpenSSH sources, and we configure them with /usr as directory for the SSH executable files, with /etc/ssh as directory where the chrooted SSH will look for configuration files, and we also allow PAM authentication:

cd /tmp
apt-get install libpam0g-dev openssl libcrypto++-dev libssl0.9.7 libssl-dev ssh
wget http://chrootssh.sourceforge.net/dow...-chroot.tar.gz
tar xvfz openssh-4.2p1-chroot.tar.gz
cd openssh-4.2p1-chroot
./configure --exec-prefix=/usr --sysconfdir=/etc/ssh --with-pam
make
make install
Reply With Quote
  #4  
Old 18th January 2007, 11:51
martinfst martinfst is offline
Senior Member
 
Join Date: Dec 2006
Location: Hilversum, The Netherlands
Posts: 880
Thanks: 1
Thanked 16 Times in 15 Posts
Send a message via MSN to martinfst Send a message via Skype™ to martinfst
Default

It won't screw you ISPConfig environment, but notice, you will have the same restrictions. So after chrooting ssh, you yourself are also bound by the limitations of a chroot-ed environment. Which means, if you ever need to look at e.g. a logfile you have to go over to the console. That's fine if you're close to your server, but my servers are located in different external datacenters, not all of them close to where I live.
Reply With Quote
  #5  
Old 18th January 2007, 13:38
PermaNoob PermaNoob is offline
Senior Member
 
Join Date: Jan 2007
Posts: 159
Thanks: 11
Thanked 4 Times in 4 Posts
Default

Martin, that's no problem if I use putty to ssh in as root, is it?
Reply With Quote
  #6  
Old 18th January 2007, 13:46
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,010
Thanks: 254
Thanked 134 Times in 120 Posts
Default

Quote:
Originally Posted by PermaNoob
Martin, that's no problem if I use putty to ssh in as root, is it?
as root you can access everything okay!
Reply With Quote
  #7  
Old 18th January 2007, 13:53
martinfst martinfst is offline
Senior Member
 
Join Date: Dec 2006
Location: Hilversum, The Netherlands
Posts: 880
Thanks: 1
Thanked 16 Times in 15 Posts
Send a message via MSN to martinfst Send a message via Skype™ to martinfst
Default

Yes, but I've disabled direct root login in my ssh server. That way, 'they' have to crack at least two passwords. So that wouldn't work for me, I think.

I've never set this up. To test it (if your not close to the console) I'd do:
  1. login to at least two or three ssh sessions
  2. change everything to chroot ssh
  3. Restart ssh deamon on your server. Existing sessions are not affected
  4. login with yet another session
  5. test if you can do: su -
  6. verify if you have access to the absolute root directory of your server
  7. if not, immediately disable chrooted ssh, try to find the answer why it didn't work, fix it, and repeat the sequence above.
Even better is to test this on a spare local machine....
Reply With Quote
  #8  
Old 18th January 2007, 14:31
edge edge is offline
Moderator
 
Join Date: Dec 2005
Location: The Netherlands
Posts: 2,010
Thanks: 254
Thanked 134 Times in 120 Posts
Default

Quote:
Yes, but I've disabled direct root login in my ssh server. That way, 'they' have to crack at least two passwords. So that wouldn't work for me, I think.
Login as normal users, and than use the command su (super user) and enter the root password.

After this you are loged in as root.
Reply With Quote
  #9  
Old 18th January 2007, 15:15
jnsc jnsc is offline
rotaredoM
 
Join Date: Mar 2006
Location: Lausanne, Switzerland
Posts: 517
Thanks: 7
Thanked 164 Times in 73 Posts
Default

Just to correct a common error: su does not mean super user but substitute user
Reply With Quote
  #10  
Old 18th January 2007, 15:34
martinfst martinfst is offline
Senior Member
 
Join Date: Dec 2006
Location: Hilversum, The Netherlands
Posts: 880
Thanks: 1
Thanked 16 Times in 15 Posts
Send a message via MSN to martinfst Send a message via Skype™ to martinfst
 
Default

Quote:
Originally Posted by jnsc
Just to correct a common error: su does not mean super user but substitute user
100% correct. It will give you super user rights is used without a user argument.
That's why I use
Code:
su -
, which is as close as you can get on my systems as root (besides connecting a screen and keyboard on the console ports). Try
Code:
id
It will show you are root.
Nah, I even don't use that (su -) anymore. I've modified my /etc/sudoers file to be able to do what needs to be done, without ever having the need to directly logon as root.

Errrrrm, maybe we should keep an eye on the original question about chroot-ing ssh and the implications that may have on accessing a system. My apologies for the more-or-less off-topic drifting of this thread. I'm afraid I've been responsible for that.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ISPConfig on a RaQ2 mattm Installation/Configuration 12 23rd January 2008 18:17
RedHat 9: Install problems AaronNGray Installation/Configuration 33 10th March 2007 10:32
Installation Problem irpr Installation/Configuration 21 13th December 2006 11:55
64-bit Debian 3.1 Install Issue naruto Installation/Configuration 14 5th September 2006 04:12
Update to 2.2.0 question brianetilley Installation/Configuration 10 4th March 2006 17:02


All times are GMT +2. The time now is 10:05.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.