1833176 Members
2844 Online
110051 Solutions
New Discussion

ftpaccess

 
John Carver
Frequent Advisor

ftpaccess

I have configured a guest ftp user. I have followed the various documents I found on the
itrc site and even the wu-ftp site. I can log
in using this guest user, but the chroot spec
in the passwd file isn't changing the effective
root. I can still cd to any where on the system.
7 REPLIES 7
someone_4
Honored Contributor

Re: ftpaccess

Hi john,
Here is a doc telling you how to fix and what to check to make sure you cant cd anywhere on the system.


##############

Problem Description

How do I configure the new ftpd at HP-UX 11.0 to chroot on
certain users?

Configuration Info

Operating System - HP-UX
Version - 64-bit 11.0
Hardware System - HP9000
Series - V2250

Solution

Use this procedure to configure the new ftpd:

Note: A user will not have the ability to travel anywhere outside
of his home directory on the system. Setting up a bogus
shell with exit 0 as the contents will cause the connection
of a user to be immediately terminated if the user attempts
to telnet into the system.

1. Configure the ftpaccess file:

a. cd /etc/ftpd

b. cp -p /usr/newconfig/etc/ftpd/ftpaccess .

c. vi ftpaccess. At the bottom of the file there is a guestgroup
directive 'guestgroup ftponly'.

i. Either change that group designation to one you already
have or keep that designation.

ii. If you are keeping the ftponly group, then create that
group on your system.


2. Modify the /etc/inetd.conf file to enable the use of the ftpaccess
file:

a. vi /etc/inetd.conf

b. Add the -a flag to the ftp daemon.

c. ftp stream tcp nowait root /usr/lbin/ftpd ftpd -a -l

4. Make inetd re-read its configuration:

inetd -c

5. Create a bogus shell for users that will only have FTP access to
the system:

a. vi /usr/bin/ftpshell

b. exit 0

c. chmod 555 /usr/bin/ftpshell

d. chown bin:bin /usr/bin/ftpshell

6. Create an /etc/shells file:

a. vi /etc/shells

b. Include these lines in the file:

/sbin/sh
/usr/bin/ksh
/usr/bin/sh
/usr/bin/csh
/usr/bin/rsh
/usr/bin/rksh
/usr/bin/keysh
/bin/sh
/bin/ksh
/bin/csh
/bin/rsh
/bin/rksh
/usr/bin/ftpshell

7. Now add a user to the system. Use a group that is 'ftponly' and
make the user's shell /usr/bin/ftpshell.

8. Use SAM to limit the user to his home directory by setting up the
directory in this form:

/home/username/./

Note: The /./ is the important key here. When the ftpd verifies a
user's login, it checks and sees that the user is a member of
the 'guestgroup' ftponly. It then examines the home directory
and, if it sees a /./ in the path, it will then perform a chroot
to that directory. Therefore, when that user FTPs into the
system, their home directory will appear as the / directory.

9. Provide the user with an ls command:

a. cd /home/username

b. mkdir usr

c. mkdir usr/bin

d. cp -p /sbin/ls usr/bin

e. chown -R bin:bin usr

f. chmod -R 555 usr
Deshpande Prashant
Honored Contributor

Re: ftpaccess

Hi
Check for the users home directory.
It should end with /./ for chroot to be effective.

Thanks.
Prashant.
Take it as it comes.
Shannon Petry
Honored Contributor

Re: ftpaccess

I still have a document out there which explains the chroot and how to configure ftpd.
http://www.invenioeng.com/systems/ftpd_faq.html

Regards,
Shannon
Microsoft. When do you want a virus today?
Jose Mosquera
Honored Contributor

Re: ftpaccess

Hi,

Follow the mates recomendations, just pls remember that you are running on HP-UX 10.20 you need download wu-ftp software depot from http://hpux.cs.utah.edu/hppd/hpux/Networking/FTP/wu_ftpd-2.6.1/

wu-ftp is not built-in from factory in HP-UX 10.20

Rgds
Sanjay_6
Honored Contributor

Re: ftpaccess

Hi John,

If you are using 10.20, chroot may not work for you. If you are using 11.0 or above make sure the user home directory in /etc/passwd looks like /home/user_name/./ . In this case /home/user_name will be / for this particular user.

Hope this helps.

Regds
Shannon Petry
Honored Contributor

Re: ftpaccess

chroot works just fine in 10.20, and actually even in 9.05 and 9.07 though unsupported. I have been running wu_ftpd since the 9.07 days.....
Microsoft. When do you want a virus today?
Shannon Petry
Honored Contributor

Re: ftpaccess

So is your problem fixed?
If now what did we miss in our answers?
If so why not return the courtesy to the people who took time out of their day, free of charge, and assign them points accordingly.

Regards,
Shannon
Microsoft. When do you want a virus today?