Operating System - HP-UX
1754419 Members
2721 Online
108813 Solutions
New Discussion юеВ

cd command in an ftp session

 
SOLVED
Go to solution
Lino Martinez
Contributor

cd command in an ftp session

Hi everybody
How can I restrict the cd command in an ftp session?

I want that a user can't navigate the tree in the ftp session.

thanks in advance!
3 REPLIES 3
Michael Steele_2
Honored Contributor

Re: cd command in an ftp session

Change the user's shell to restricted. I.e., rksh or rsh.

See a list of all shells in /etc/shells.
Support Fatherhood - Stop Family Law
Yogeeraj_1
Honored Contributor
Solution

Re: cd command in an ftp session

hello,

have a look at my post at:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xc736b941255cd71190080090279cd0f9,00.html


tons of information there!

in summary:
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 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/false

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

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

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


hth
Yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Dave La Mar
Honored Contributor

Re: cd command in an ftp session

I used the following to set up a particular user as well as
DOC NR0801KBRC00007714

http://support2.itrc.hp.com/service/cki/search.do?searchString=A5651654&mode=id&submit=Search&searchCrit=allwords&docType=Security&docType=Patch&docType=EngineerNotes&docType=BugReports&docType=Hardware&docType=ReferenceMaterials&docType=ThirdParty

I think you will find what you need here as well.

Best of luck.

dl
"I'm not dumb. I just have a command of thoroughly useless information."