Wednesday, May 26, 2010

FreeBSD FTP access without SSH access

I ran into this problem on the freebsd server today.  FTP users had FTP and SSH access to my entire system but i only wanted them to have access to their FTP home directory.  Using the following links i was able to solve my problem:


Listed below is how i fixed this issue:

  1. Add user names to /etc/ftpchroot. This makes the user accounts unable to navigate outside of their Home directory. # nano /etc/ftpchroot add [username]
  2. Add the nologin "shell" to your shell list so that ftpd sees it as a a valid shell. # nano /etc/shells
    add "
    /sbin/nologin"

    Should look something like this:



    # $FreeBSD: src/etc/shells,v 1.5 2000/04/27 21:58:46 ache Exp $
    #
    # List of acceptable shells for chpass(1).
    # Ftpd will not allow users to connect who are not using
    # one of these shells.

    /bin/sh
    /bin/csh
    /bin/tcsh
    /usr/local/bin/bash
    /sbin/nologin

  3. Finally we need to edit the user account to use the nologin shell using the following command:

    # pw usermod -n [username] -s /sbin/nologin

Hope you find this helpful

No comments:

Post a Comment

Phoenix

I am resurrecting this tech blog for notes related to Azure Logic Apps with SAP.