Operating System - HP-UX
1836532 Members
4100 Online
110101 Solutions
New Discussion

Where does the ~/ftp/etc/passwd files belong

 
Bill Costigan
Honored Contributor

Where does the ~/ftp/etc/passwd files belong

Another restricted ftp question.

Looking at the man pages, it talks about creating the ~/ftp/etc/passwd and group file.

Using a restricted user, I only see the user ID and Group ID numbers when I do a dir.

I tried creating the etc/password and group file under the root of the guest user, I tried ftp/etc/ of the guest user, a system root of /ftp/etc/password. The root's directory
/homeroot/etc/password, /homeroot/ftp/etc/password.

I cann't figure out where wu-ftpd is looking. The guide says ~/ftp/etc/password. It's not clear to me who's home ~ refers to.

Please help.
3 REPLIES 3
Jeff_Traigle
Honored Contributor

Re: Where does the ~/ftp/etc/passwd files belong

Youre reading in an extra /. The path for the files is ~ftp/etc. If you set the home directory for the ftp user to be /home/ftp, the path for the passwd file would be /home/ftp/etc/passwd.
--
Jeff Traigle
Bill Costigan
Honored Contributor

Re: Where does the ~/ftp/etc/passwd files belong

I think tried that also

in the real /etc/password file for user1 I have :/dir1/dir2/dir3/./:

User user1 FTPs in and finds himself in /dir1/dir2/dir3/ and that looks like '/' to him.

As root, I create the file /dir1/dir2/dir3/etc/passwd and make the 'etc' directory and 'password' file world readable. As user1 I can do a DIR /etc/
and I see the passwd file. I do the DIR and still only see the numeric IDs.

That's when I started copying the passwd file to every other place I could think of that ftpd might be looking.
Bill Costigan
Honored Contributor

Re: Where does the ~/ftp/etc/passwd files belong

I solved the problem. In case anyone else happens to find this thread while trying to solve a similar problem.....

There are two different versions of 'ls' on HPUX

/sbin/ls
/usr/bin/ls

The one in /usr/bin/ls calls routines in libraries under /usr/lib/ and it seems cannot use a different /etc/passwd.

The one under /sbin seems to be self contained and doesn't call other routines and can use a differnet /etc/password.

test-

/dir1/dir2/usr/bin/ls
/dir1/dir2/usr/lib/....
/dir1/dir2/etc/passwd and group

as root..
chroot /dir1/dir2/ /usr/bin/ls -l

if I copied the ls found in /usr/bin to my usr/bin, I got numbers for user and group id
if I copied the ls found in /sbin I got names.

I then completely removed the /usr/lib directory from under /dir1/dir2 and the ls from /sbin still worked.

Tested it from a restricted FTP session and all is Good.

Oh and the /etc/passwd does go under the FTP user's chroot directory I.e., the first part of the directory located in the real /etc/passwd file
in my case :/dir1/dir2/./: