Ubuntu Server Guide
Download 1.23 Mb. Pdf ko'rish
|
ubuntu-server-guide (1)
Securing FTP
There are options in /etc/vsftpd.conf to help make vsftpd more secure. For example users can be limited to their home directories by uncommenting: c h r o o t _ l o c a l _ u s e r=YES You can also limit a specific list of users to just their home directories: 164 c h r o o t _ l i s t _ e n a b l e=YES c h r o o t _ l i s t _ f i l e =/ e t c / v s f t p d . c h r o o t _ l i s t After uncommenting the above options, create a /etc/vsftpd.chroot_list containing a list of users one per line. Then restart vsftpd: sudo s y s t e m c t l r e s t a r t v s f t p d . s e r v i c e Also, the /etc/ftpusers file is a list of users that are disallowed FTP access. The default list includes root, daemon, nobody, etc. To disable FTP access for additional users simply add them to the list. FTP can also be encrypted using FTPS. Different from SFTP, FTPS is FTP over Secure Socket Layer (SSL). SFTP is a FTP like session over an encrypted SSH connection. A major difference is that users of SFTP need to have a shell account on the system, instead of a nologin shell. Providing all users with a shell may not be ideal for some environments, such as a shared web host. However, it is possible to restrict such accounts to only SFTP and disable shell interaction. To configure FTPS, edit /etc/vsftpd.conf and at the bottom add: s s l _ e n a b l e=YES Also, notice the certificate and key related options: r s a _ c e r t _ f i l e =/ e t c / s s l / c e r t s / s s l −c e r t −s n a k e o i l . pem r s a _ p r i v a t e _ k e y _ f i l e=/ e t c / s s l / p r i v a t e / s s l −c e r t −s n a k e o i l . key By default these options are set to the certificate and key provided by the ssl-cert package. In a production environment these should be replaced with a certificate and key generated for the specific host. For more information on certificates see Security - Certificates. Now restart vsftpd, and non-anonymous users will be forced to use FTPS: sudo s y s t e m c t l r e s t a r t v s f t p d . s e r v i c e To allow users with a shell of /usr/sbin/nologin access to FTP, but have no shell access, edit /etc/ shells adding the nologin shell: # / e t c / s h e l l s : v a l i d l o g i n s h e l l s / b i n / c s h / b i n / sh / u s r / b i n / e s / u s r / b i n / ksh / b i n / ksh / u s r / b i n / r c / u s r / b i n / t c s h / b i n / t c s h / u s r / b i n / e s h / b i n / dash / b i n / bash / b i n / rb a sh / u s r / b i n / s c r e e n / u s r / s b i n / n o l o g i n This is necessary because, by default vsftpd uses PAM for authentication, and the /etc/pam.d/vsftpd con- figuration file contains: auth r e q u i r e d pam_shells . s o 165 The shells PAM module restricts access to shells listed in the /etc/ shells file. Most popular FTP clients can be configured to connect using FTPS. The lftp command line FTP client has the ability to use FTPS as well. Download 1.23 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling