1830520 Members
2871 Online
110006 Solutions
New Discussion

chroot in FTP

 
SOLVED
Go to solution
Ruben Cardenal
Frequent Advisor

chroot in FTP

Hi, If I have a diretory named /A and I want to setup an only-ftp account chrooted to that dir, what is the correct format entry for the user in /etc/passwd?

TIA
7 REPLIES 7
Vincenzo Restuccia
Honored Contributor
Sanjay_6
Honored Contributor

Re: chroot in FTP

Hi Ruben,

The ftp only user id home directory should be /A/./

Hope this helps.

Regds
Joseph C. Denman
Honored Contributor

Re: chroot in FTP

Also take a look at ftpaccess

man 4 ftpaccess

...jcd...
If I had only read the instructions first??
Ruben Cardenal
Frequent Advisor

Re: chroot in FTP

I have done the following:

* Created a group for that user:

root@grecopr2:/yo# cat /etc/group | grep agri
ftpagri::105:agri
root@grecopr2:/yo#

* Setup the /etc/passwd entry:

root@grecopr2:/yo# cat /etc/passwd | grep agri
agri:L5oxlGqm84Zj2:350:105:Prueba de Ruben:/yo/./:/usr/bin/false
root@grecopr2:/yo#

* Setup /etc/ftpd/ftpaccess:

root@grecopr2:/yo# cat /etc/ftpd/ftpaccess | grep guestgroup
guestgroup ftpagri
root@grecopr2:/yo#

* Added "-a" option to inetd.conf entry for ftpd:

root@grecopr2:/yo# cat /etc/inetd.conf | grep /ftpd
ftp stream tcp nowait root /usr/lbin/ftpd ftpd -l -a
root@grecopr2:/yo#

* Restarted inetd.

* Now, I try to use the account:

root@grecopr2:/# ftp localhost
Connected to localhost.
220 grecopr2 FTP server (Version 1.1.214.7 Thu Aug 10 09:57:38 GMT 2000) ready.
Name (localhost:root): agri
331 Password required for agri.
Password:
230 User agri logged in. Access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> pwd
257 "/" is current directory.
ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /usr/bin/ls.
226 Transfer complete.
ftp> quit
221 Goodbye.
root@grecopr2:/#

It doesn't list! Says it lists "/usr/bin/ls" :? If I upload something, make dirs, delete, etc, it works fine, but listing doesn't. What am I doing wrong? :(
Steven Sim Kok Leong
Honored Contributor

Re: chroot in FTP

Hi,

What are the permissions of your FTPROOT directory? It has to be r-x (readable and executable) by the FTP user in order to allow files to be listed.

To troubleshoot, try setting your FTPROOT to

# chmod ugo+rx YOUR_FTPROOT

After FTP logon, perform a dir, ls and ls -la.

Hope this helps. Regards.

Steven Sim Kok Leong
Barry_2
Occasional Advisor
Solution

Re: chroot in FTP

If you can't do a directory list, means that you have no cmd to do such ... So, use 'man ftpd'. Starting from section 'Anonymous connexion' It will explain the way to give access to local cmds and shared libs needed by dir or mkdir or so.
Grip the Unix Banner
Ruben Cardenal
Frequent Advisor

Re: chroot in FTP

Thanks to all for your interest and help. The 10 goes to Barry due to his precission with listing issue :)