Operating System - HP-UX
1833797 Members
4507 Online
110063 Solutions
New Discussion

ftpaccess : directories seems empty

 
SOLVED
Go to solution
Fred Ruffet
Honored Contributor

ftpaccess : directories seems empty

Hi,

I've just set up ftpaccess file on a server. Everything runs fine. Normal users can use ftp just has they done before, and one particular ftpuser is chrooted.
If I use a DOS client, ftp will display content of directories when using ls. If I use any other client, directory seems empty (but I can cd to a subdirectory).
What's that ?

Examples :

--- from DOS client
T:\>ftp serva
Connecté à serva.
220 serva FTP server (Version 1.1.214.8 Fri Apr 20 07:27:42 GMT 2001) ready.
Utilisateur (servb:(none)) : ftpuser
331 Password required for ftpuser.
Mot de passe :
230 User ftpuser logged in. Access restrictions apply.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for file list.
toto
226 Transfer complete.
ftp : 6 octets reçus dans 0,00Secondes 6000,00Ko/sec.
ftp> cd toto
250 CWD command successful.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for file list.
file.txt
226 Transfer complete.
ftp : 10 octets reçus dans 0,00Secondes 10000,00Ko/sec.
ftp> quit
221 Goodbye.
---

--- from other client (HP-UX for this example)
root@servb:/ >ftp serva
Connected to serva.
220 serva FTP server (Version 1.1.214.8 Fri Apr 20 07:27:42 GMT 2001) ready.
Name (serva:root): ftpuser
331 Password required for ftpuser.
Password:
230 User ftpuser logged in. Access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for /usr/bin/ls.
226 Transfer complete.
ftp> cd toto
250 CWD command successful.
ftp> ls
200 PORT command successful.
150 Opening ASCII mode data connection for /usr/bin/ls.
226 Transfer complete.
ftp> quit
221 Goodbye.
---

Note that there is no error. Only directory content is not listed.

Regards,

Fr
--

"Reality is just a point of view." (P. K. D.)
4 REPLIES 4
Sanjay_6
Honored Contributor
Solution

Re: ftpaccess : directories seems empty

Hi Fred,

You probably need to copy the /sbin/ls into $USER_HOME/usr/bin/ls instead of using the regular /usr/bin/ls. This is because /sbin/ls is statically linked and does not need libraries that are required in executing /usr/bin/ls.

Say the chrooted directory for the use is /some_path/userid. Copy /sbin/ls to /some_path/userid/usr/bin/ls.

Hope this helps.

Regds

Steven E. Protter
Exalted Contributor

Re: ftpaccess : directories seems empty

Hi Fred,

I'm assumping by DOS ftp, you are referring to the one built in by Microsoft.

Thats a very problematic client.

For the chroot user, the most likely reason for not being to see any files, is a lack of access to the /usr/bin/ls utility, which ftp uses. You'll note that ls command line options work a normal session.

You'll need to copy ls binary into the login directory or a subdirectory(usually called bin) so that the ls command works for the chroot user.

Also note OT: I posted the version numbers on that samba/cifs Linux thread.

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
Fred Ruffet
Honored Contributor

Re: ftpaccess : directories seems empty

You're absolutely right !

I didn't realized that it was a real chroot. I believed that ftpd was restricting accesses, but in fact, ftp process is chrooted.

mkdir $USER_HOME/bin
cp /sbin/ls $USER_HOME/bin/ls

and all is good.

What I still don't understant is why DOS client sees content ?

Thanks,

Fred
--

"Reality is just a point of view." (P. K. D.)
Sanjay_6
Honored Contributor

Re: ftpaccess : directories seems empty

Hi Fred,

My opinion is that the dos ftp client has the ls command builtin, like "DIR" is a intrinsic command for the command.com for DOS. On the other hand the unix ftp client uses /usr/bin/ls for the ls command.

Hope this helps.

Regds