proftpd – setting up a quick ftp server

This was created off of:

yum -y install proftpd.x86_64

echo “/bin/false” >> /etc/shells

cd /home
sudo mkdir FTP-shared
sudo useradd userftp -p your_password -d /home/FTP-shared -s /bin/false
sudo passwd userftp
cd /home/FTP-shared/
sudo mkdir download
sudo mkdir upload
cd /home
sudo chmod 755 FTP-shared
cd FTP-shared
sudo chmod 755 download
sudo chmod 777 upload
cp /etc/proftpd.conf /etc/proftpd.conf.orig
vi /etc/proftpd.conf
  • # To really apply changes reload proftpd after modifications.
    AllowOverwrite on
    AuthAliasOnly on
    
    # Choose here the user alias you want !!!!
    UserAlias sauron userftp
    
    ServerName			"ChezFrodon"
    ServerType 			standalone
    DeferWelcome			on
    
    MultilineRFC2228 on
    DefaultServer			on
    ShowSymlinks			off
    
    TimeoutNoTransfer 600
    TimeoutStalled 100
    TimeoutIdle 2200
    
    DisplayChdir                    .message
    ListOptions                	"-l"
    
    RequireValidShell 		off
    
    TimeoutLogin 20
    
    RootLogin 			off
    
    # It's better for debug to create log files ;-)
    ExtendedLog 			/var/log/ftp.log
    TransferLog 			/var/log/xferlog
    SystemLog			/var/log/syslog.log
    
    #DenyFilter			\*.*/
    
    # I don't choose to use /etc/ftpusers file (set inside the users you want to ban, not useful for me)
    UseFtpUsers off
    
    # Allow to restart a download
    AllowStoreRestart		on
    
    # Port 21 is the standard FTP port, so you may prefer to use another port for security reasons (choose here the port you want)
    Port				1980
    
    # To prevent DoS attacks, set the maximum number of child processes
    # to 30.  If you need to allow more than 30 concurrent connections
    # at once, simply increase this value.  Note that this ONLY works
    # in standalone mode, in inetd mode you should use an inetd server
    # that allows you to limit maximum number of processes per service
    # (such as xinetd)
    MaxInstances 8
    
    # Set the user and group that the server normally runs at.
    User                  nobody
    Group                 nobody
    
    # Umask 022 is a good standard umask to prevent new files and dirs
    # (second parm) from being group and world writable.
    Umask				022	022
    
    PersistentPasswd		off
    
    MaxClients 8
    MaxClientsPerHost 8
    MaxClientsPerUser 8
    MaxHostsPerUser 8
    
    # Display a message after a successful login
    AccessGrantMsg "welcome !!!"
    # This message is displayed for each access good or not
    ServerIdent                  on       "you're at home"
    
    # Lock all the users in home directory, ***** really important *****
    DefaultRoot ~
    
    MaxLoginAttempts    5
    
    #VALID LOGINS
    <Limit LOGIN>
    AllowUser userftp
    DenyALL
    </Limit>
    
    <Directory /home/FTP-shared>
    Umask 022 022
    AllowOverwrite off
    	<Limit MKD STOR DELE XMKD RNRF RNTO RMD XRMD>
    	DenyAll
    	</Limit>
    </Directory>
    
    <Directory /home/FTP-shared/download/*>
    Umask 022 022
    AllowOverwrite off
    	<Limit MKD STOR DELE XMKD RNEF RNTO RMD XRMD>
    	DenyAll
    	</Limit>
    </Directory>
    
    <Directory /home/FTP-shared/upload/>
    Umask 022 022
    AllowOverwrite on
    	<Limit READ RMD DELE>
          	DenyAll
        	</Limit>
    
        	<Limit STOR CWD MKD>
          	AllowAll
        	</Limit>
    </Directory>

You can do a syntax check with the following:

proftpd -td5

BeagleBone Black notes

So I finally got the BBB to see the micro sd card through angstrom.  The issue is the way the bootloader is setup to boot form microsd when there is one.  So you have to create a uEnv.txt file on a “/boot” partition on the microsd card. This file will tell the system to boot off eMMC.

mkcard.sh

If you are using an sdxc card, you’ll want to install the following .deb on linux.

http://blog.drastudios.com/2013/04/add-exfat-support-to-ubuntu.html

 

Reference for this: http://dev.gentoo.org/~armin76/arm/beagleboneblack/install_emmc.xml

http://learn.adafruit.com/beaglebone-black-installing-operating-systems/ubuntu

–> tips on configuring angstrom

http://www.gigamegablog.com/2012/01/29/beaglebone-linux-101-configuring-angstrom-linux/

So I decided to install Ubuntu, as I’m more familiar with it.  I pulled an eMMC image from the following url:

http://rcn-ee.net/deb/flasher/raring/

The Drivers

Well tried to install the drivers under windows 8, and got a flat “failed” on all fronts.

Patching Angstrom

Well did an “opkg update; opkg upgrade”, and it went for a log time before it filled up its file system.

http://learn.adafruit.com/beaglebone-black-installing-operating-systems/angstrom

http://beagleboard.org/latest-images/

https://code.google.com/p/beagleboard/wiki/HowToGetAngstromRunning

CA Cert Setup for a Linux Host

Here’s how it’s done.  I’ll be using my machine as an example.  (minion.digitalw00t.com)

 

Create the csr:

openssl req -newkey rsa:2048 -subj /CN=minion.digitalw00t.com -nodes -keyout minion.digitalw00t.key -out minion.digitalw00t.csr

casert request a new server cert, copy/paste the contents of minion.digitalw00t.csr into the page and submit.

Setting up your owncloud system

I’m going to do this under ubuntu, but you can use any flavor of linux really.

OWNCLOUD_DIR="/opt/md2/owncloud"
apt-get -y install apache2 php5 php5-gd php-xml-parser php5-intl \
        php5-sqlite php5-mysql smbclient curl libcurl3 php5-curl \
        apache2 mysql-server libapache2-mod-php5 \
        php5-gd php5-json php5-mysql php5-curl \
        php5-intl php5-mcrypt php5-imagick
mkdir -p ${OWNCLOUD_DIR}
cd ${OWNCLOUD_DIR}
wget "http://download.owncloud.org/community/owncloud-5.0.15.tar.bz2"
tar -xjf ${OWNCLOUD_DIR}/owncloud-5.0.15.tar.bz2
mv owncloud/* ${OWNCLOUD_DIR}
mv owncloud/.htaccess ${OWNCLOUD_DIR}
mkdir -p ${OWNCLOUD_DIR}/data
chown -R www-data:www-data ${OWNCLOUD_DIR}/data
chown -R www-data:www-data ${OWNCLOUD_DIR}/apps
chown -R www-data:www-data ${OWNCLOUD_DIR}/config

Add the following applications:

apt-get install davfs2
echo ‘“https://your-owncloud-server-url.com/owncloud/remote.php/webdav”   yourUserName   “your password here”‘ >> /etc/davfs2/secrets
mkdir /media/owncloud
chown localUserId:localUserId /media/owncloud
echo ‘https://your-owncloud-server-url.com/owncloud/remote.php/webdav/  /media/owncloud   davfs   defaults,user,noauto,uid=1000,gid=1000  0       0′ >> /etc/fstab

 

 

 

References:

  • http://doc.owncloud.org/server/5.0/developer_manual/app/gettingstarted.html
  • WebDAV:  http://doc.owncloud.org/server/5.0/admin_manual/installation.html
  • Setting up WebDAV:  http://www.adercon.com/ac/node/100
  • http://forum.owncloud.org/viewtopic.php?f=17&t=7536 (Great for webdav debugging)

parted

parted -a opt /dev/md0
(parted) u MiB
(parted) rm 1
(parted) mkpart primary 1 100%

or an alternate dirty method would simply go like this

(parted) mkpart primary ext4 1 -1

Partition a 4tb external drive:
parted -a opt /dev/sdc
mklabel gpt
unit TB 
mkpart primary 0.00TB 4.00TB
align-check optimal 1 (check if the partition is aligned)
quit
mkfs.ext4 /dev/sdc1

You  might want to reduce the reserved for defragmentation to 1% with such a large drive.

tune2fs -m 1 /dev/sdc1