1843978 Members
1679 Online
110226 Solutions
New Discussion

FTP and telnet conection

 
David_711
Frequent Advisor

FTP and telnet conection

Hi everyone!!,
I need to avoid that a user on hpux 11.11 can move from your home directory to another inside the system when he use ftp or telnet.
Somebody know how i can configure my ftp and telnet services for avoid this?

Pleases help,
Thanks
2 REPLIES 2
Steven E. Protter
Exalted Contributor

Re: FTP and telnet conection

Shalom,

The general concept is called chroot.

For ftp, you use /etc/ftp/ftpaccess and set chroot for the usr and then they can't get out of the home directory.

You may want to go with Secure Shell instead of telnet.

http://docs.hp.com/en/T1471-90017/T1471-90017.pdf
That doc shows how to chroot it.

You may be able to make this work with telnet.

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Raj D.
Honored Contributor

Re: FTP and telnet conection

David,

You can configure ftponly account with restrictions ,

Here is the procedure:
-------------------------------



Configuring new ftpd at HP-UX 11.0 to chroot on certain users?
------------------


Procedure to configure new ftponly account:

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
--------------------------------


Cheers,
Raj.

" If u think u can , If u think u cannot , - You are always Right . "