SSH user can read root files?

Scolpy

Verified User
Joined
Feb 25, 2009
Messages
137
Hello!

I saw that in default, normal ssh user can see files wit root ownership - how that is possible?

Also, I've watched this article:
http://help.directadmin.com/item.php?id=90

But I see that is effective just for PHP CGI and not for PHP CLI.

So in which way I can resolve that secure issue?

Thanks!
 
That is normal, and should not be a problem. Also, take a big shared hosting provider like Dreamhost.com for example - get a account there, and you will see that you can browse in root user folders.

But you should use something like suPHP, or thats alike.
 
That is normal, and should not be a problem. Also, take a big shared hosting provider like Dreamhost.com for example - get a account there, and you will see that you can browse in root user folders.

But you should use something like suPHP, or thats alike.
so there is no solution to PHP CLI?
 
What do you mean root user files?

Show an example of what files you mean.
 
You can set up ssh with chroot. Search these forums and elsewhere on the 'net.

Jeff
 
You can set up ssh with chroot. Search these forums and elsewhere on the 'net.

Jeff
Can you provide me some likes that might be help to me(I have CentOS 5.5 64bit) - all articles I found is for Debian or OpenBSD and the only thing I found for CentOS is rSSH(not good for me).

Thanks!
 
It is built into custombuild.

Check the custombuild section of the forum.

You should never be able to get into the /root folder though that is kinda weird.

Anyways you should never give out ssh access unless you absolutely need to.
 
That guide almost seems outdated talking about customapache. I cant seem to find any other guides for setting it up and havent used it personally.

Try to get ahold of smtalk or wait from a post from him or directadmin support for a proper guide to using it.
 
You're right. Apologies, I did some digging up and it doesn't work. I'll look into this later, I've never done it before but I'm sure it possible.
You mean that is possible to merge Jailkit with DirectAdmin?
 
I meant to files in directories like:
/root/*
/etc/*
/bin/*

and stuff...
Hello,

DirectAdmin relies on the linux security model to help out with keeping important files safe. You mention your /root directory is readable. Since users are running as "username", then you'd simply make sure your /root folder is chowned to root:root, and is chmod to 700. If it's 755, then change it 700.

It is normal for the /bin and /etc folders to be readable by system accounts. For example, the /etc/passwd should be 644 (readable) so that clients can get proper uid numbers for files on disk. The /etc/shadow should be 600 (not readable) since it contains the crypted passwords. Clients can see the contents of the /etc folder, but it doesn't mean they can get the data in each file (depending on permissions of the file)

In any case, chroot ssh is safer.. or better yet, no ssh.
This guide would be the solution to jail ssh if you want. You don't need to use the cgi-bin jailing if you don't want to. It makes things a bit messy and the guide is for apache 1.3. The guide is eternally in beta testing due to the complexity of it, and because each OS is different and has libraries in different locations. It may or may not work for you.

There are other things you can use to increase security though. Many are listed here:
http://help.directadmin.com/item.php?id=247

One good one is the secure_access_group, setup by DA:
http://www.directadmin.com/features.php?id=961

which sets the /home/username folders to 750, chown username:access.. where the "access" group is a list of system usernames that can see in. Other ssh users will not be able to see in.

Tip #14 of the id=961 guide is also a creative way of blocking specific usernames from accessing files or folders. A new group called "users" could be created.. where all ssh Users are in it.. and you'd simply set the group of a file or folder to "users" and chmod it to 604 or 705 (respectively) and anyone in "users" won't be able to see in that folder.

For example, if you wanted to block "users" from seeing in the /etc directory, create the "users" group, add your ssh account names to it.. and type
Code:
chgrp users /etc
chmod 705 /etc
and then anyone in users won't be able to read /etc. Note, I have not tested this.. so it may be a bad example and could break things.. but it should get the point across as to what I mean about using the negation permission (0) on files/folders with respect to groups.

John
 
Back
Top