Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Wednesday, October 3, 2012

Linux FTP server

I setup an FTP server today using Linux.  This is my first time doing this.  It was relatively simple.  I have to tweak the users and groups yet but that should not be too big of a deal.  I wanted some space that I could store some files and access them from a web browser making it easier to do from my tablet or a guest PC.

I used Ubuntu 12.04 which I have been using exclusively for Linux stuff since it makes more sense to me logically how the config files work on the system.

Here are the steps to setup FTP:

-Install the distro, (I have a VM Template)
-Address the Server in the /etc/network/interfaces file.
-I turn off the firewall: sudo ufw disable
-I used vsftp (very secure ftp): sudo apt-get install vsftpd
-Now go to the config file at: /etc/vsftpd.conf and open it in an editor
-If you want to have anonymous users have download access you will need to unremark: #anonymous_enable=yes  (I left mine as is as I don't want just anyone being able to access my files).
-Unremark #write_enable=yes
-Add users: sudo adduser <username>

By Default the ftp directory is located at /srv/ftp  This is fine for my use but you can change it by using the mkdir commands.

I will be massaging this as I learn more, but for now this gets the meat and bones of it up and running.

Cheers!

Friday, September 14, 2012

Zimbra Bulk User Delete

One of the responsibilities I have in my environment is to manage all the user accounts in Active directory and our mail system.  We use a Zimbra mail system which is hosted for us.  If you are unfamiliar with Zimbra the quick story is that it was started up by Zimbra inc., purchased by Yahoo! in 2007 and acquired by VMware sometime between 2010 and 2011.  I am crazy in love with VMware but this is a solution I believe they could have done with out.  (Just my opinion).  :)

Zimbra is an open source solution.  There is some commercially supported version of Zimbra, but since we are having it hosted for us, I cannot speak about it.  I believe it is primarily an open source solution though.  The control panel for administration is not very helpful on an Enterprise administration level.  There is no way to bulk upload, delete or apply attributes to users.  In the Enterprise Education platform  this is a nightmare for me. 

I was working with our provider on a way to handle the bulk uploads of our student accounts.  Of course the provider will do it for me if I send them a CSV file with the accounts I need added... but I am an Enterprise Admin... I want to do it myself!  :)  

I got some instructions on how to setup a CLI utility called zmprov which is used to provision accounts on a Zimbra server.  It needs to run on a linux server.  I choose Ubuntu 12.  Once this is setup you can simply use some commands found on the zmprov wiki site to help you provision bulk uploads and deletes amongst a ton of other things.  One would have to be very careful in doing this as you can do serious damage to your accounts if you type the wrong thing.

The instructions are as follows:
-Stand up a Linux VM
-Follow these instructions to install zmprov.  (These are tailored for using a hosted zimbra)

Once that was done (after a few trial and errors), I cheated on the bulk deletion of users.  Instead of using a CSV file and importing it to the zmprov server and launching a ridiculously tailored script, I found that if you setup your CSV file correctly you could just copy and paste the context of the file into the ssh session on your zmprov server.  Here is what I did:

-Dumped a CSV file of the users from the Zimbra admin panel. 
-Removed the users I did not want to delete from the file.
-Removed all the columns of the CSV file except the email address.
-Moved the email address field to the "C" column.
-In column "A" added the command: zmprov -s <servername> -a <adminaccount> -p <password>
-In column "B" I added: da
-Saved the file as a text file.
-Opened the file in notepad and did a replace command.  Replaced , with a blank space.  Saved the file.

Now you have a txt file with the delete account command for each account.  So now each string for each account you want to delete looks like this:

zmprov -s <servername> -a <adminaccount> -p <password> da account@domain.com

Im my case I had 240 lines of this because I was delete 240 accounts.  I literally copied the entire contents of that txt file and pasted it into the zmprov ssh session and off it went!  About an hour later all 240 accounts were gone!

I suppose you could do the same thing for creating accounts by using the "ca" (create account command).

Cheers!